Learn about the Python yield statement which is used to create generators.
“Count your age by friends, not years. Count your life by smiles, not tears.”
― John Lennon
Python provides an yield statement which allows you to create generator functions. What is a generator function and how does the yield statement help with it? Let us find out in this article.
Continue reading “What is the Python Yield Statement?”
Introduction to Sorting Dictionaries in Python
Dictionaries in python are unsorted. They are stored by the hash value of the key, and this allows for fast lookup. In this article, we show a couple of ways in which dictionaries can be sorted.
Continue reading “Sorting Dictionaries in Python”
Python supports sets which are a collection of unique elements and provide operations for computing set union, intersection and difference.
“The world is a book and those who do not travel read only one page.”
― Augustine of Hippo
A set is a collection of unique elements. A common use is to eliminate duplicate elements from a list. In addition, it supports set operations like union intersection and difference.
Continue reading “An Introduction to Python Sets”
Learn how to use Python Scrapy to Extract information from Websites.
“When life gives you lemons, chunk it right back.”
― Bill Watterson
Scrapy is a python-based web crawler which can be used to extract information from websites. It is fast, simple and can navigate pages just like a browser can.
Continue reading “Getting Started with Scrapy”
Learn how to list contents of a directory from python. Also, easily find and process files matching conditions from your python program.
“If at first you don’t succeed, destroy all evidence that you tried.”
― Steven Wright
There are several methods to list a directory in python. In this article we present a few of these along with the caveats for each.
Continue reading “Listing a Directory With Python”
Learn how to massage data using pandas DataFrame and plot the result using matplotlib in this beginner tutorial.
“There is only one thing that makes a dream impossible to achieve: the fear of failure.”
― Paulo Coelho, The Alchemist
Matplotlib is a graphics and charting library for python. Once data is sliced and diced using pandas, you can use matplotlib for visualization. In this starter tutorial, we take you through the steps to do just that.
Continue reading “Pandas Tutorial – Using Matplotlib”
Demonstrates grouping of data in pandas DataFrame and compares with SQL.
“Don’t waste your time with explanations: people only hear what they want to hear.”
― Paulo Coelho
Let us learn about the “grouping-by” operation in pandas. While similar to the SQL “group by”, the pandas version is much more powerful since you can use user-defined functions at various points including splitting, applying and combining results.
Continue reading “Pandas Tutorial – Grouping Examples”
Did you know that you can perform SQL-like selections with a pandas DataFrame? Learn how!
“Always keep your words soft and sweet, just in case you have to eat them.”
― Andy Rooney
In this article, we present SQL-like ways of selecting data from a pandas DataFrame. The SELECT clause is very familiar to database programmers for accessing data within an SQL database. The DataFrame provides similar functionality when working with datasets, but is far more powerful since it supports using predicate functions with a simple syntax.
Continue reading “Pandas Tutorial – SQL-like Data Selection”
Learn the various ways of selecting data from a DataFrame.
“Always and never are two words you should always remember never to use. ”
― Wendell Johnson
After covering ways of creating a DataFrame and working with it, we now concentrate on extracting data from the DataFrame. You may also be interested in our tutorials on a related data structure – Series; part 1 and part 2.
Continue reading “Pandas Tutorial – Selecting Rows From a DataFrame”
Learn the basics of working with a DataFrame in this pandas tutorial.
“The line between failure and success is so fine. . . that we are often on the line and do not know it.”
― Elbert Hubbard
The DataFrame is the most commonly used data structures in pandas. As such, it is very important to learn various specifics about working with the DataFrame. After learning various methods of creating a DataFrame, let us now delve into some methods for working with it.
Continue reading “Pandas Tutorial – DataFrame Basics”