One of the most common tasks in data science is to manipulate the data frame we have to a specific format. For example, sometime we may want to take data frame with fewer columns, say in long format, summarize and convert into a data frame with multiple columns, i.e. a wide data frame. Python Pandas […]
Pandas DataFrame
How To Merge/Join DataFrames with Pandas in Python?
One of the most common data science tasks – data munge/data cleaning, is to combine data from multiple sources. When you have the data in tabular forms, Python Pandas offers great functions to merge/join data from multiple data frames. Here we will see example scenarios of common merging operations with simple toy data frames. Let […]
How To Loop Through Pandas Rows? or How To Iterate Over Pandas Rows?
Sometimes you may want to loop/iterate over Pandas data frame and do some operation on each rows. Pandas has at least two options to iterate over rows of a dataframe. Let us see examples of how to loop through Pandas data frame. First we will use Pandas iterrows function to iterate over rows of a […]
How to Join Two Text Columns into a Single Column in Pandas?
Often one may want to join two text columns into a new column in a data frame. For example, one may want to combine two columns containing last name and first name into a single column with full name. We can use Pandas’ string manipulation functions to combine two text columns easily. There are a […]
How to Split a Single Column in Pandas into Multiple Columns
Often you may have a column in your pandas data frame and you may want to split the column and make it into two columns in the data frame. For example, one of the columns in your data frame is full name and you may want to split into first name and last name (like […]