Data in wide form is often easy to read for human eyes. However, you might need data in tidy/long form for data analysis. In Pandas there are a few ways to reshape a dataframe in wide form to a dataframe in long/tidy form. In this post we will see a simple example of converting a […]
Pandas 101
Pandas Groupby and Compute Mean
One of most common use of Pandas’ groupby function is to compute some summary statistics on one or more variables in the dataframe. In this post we will see an example of how to compute mean on all numerical variables and a select variable after groupby operation. Let us first load Pandas package. We will […]
Getting Started with Pandas Groupby
Pandas groupby function is one of the most useful functions enabling a bunch of data munging activities. A simple use case of groupby function is that we can group a bigger dataframe by a single variable in the dataframe into multiple smaller dataframes. Typically, after grouping by a variable, we perform some computations on each […]
How To Add Identifier Column When Concatenating Pandas data frames?
Pandas concat() function is great for concating two data frames or appending one dataframe to another with same columns. Sometimes, you might want to keep an identifier for each appended dataframe. In this post, we will see an example of how to concat two dataframes with an identifier. Let us import Pandas and numpy to […]
How To Save Pandas Dataframe as Excel File?
In this post, we will see examples of saving a Pandas dataframe as Excel file. Pandas has to_excel() function to write a dataframe into Excel file. Let us load Pandas. We will create two lists and us these to create a dataframe as before. We can create a Pandas dataframe using the two lists to […]