A common step in data analysis is to group the data by a variable and compute some summary statistics each subgroup of data. For example, one might be interested in mean, median values, or total sum per group. In this post, we will see an example of how to use groupby() function in Pandas to […]
Pandas 101
Pandas explode(): Convert list-like column elements to separate rows
Panads explode() function is one of the coolest functions to help split a list like column elements into separate rows. Often while working with real data you might have a column where each element can be list-like. By list-like, we mean it is of the form that can be easily converted into a list. Let […]
Pandas Melt: Reshape Wide to Tidy with identifiers
Pandas melt() function is a versatile function to reshape Pandas dataframe. Earlier, we saw how to use Pandas melt() function to reshape a wide dataframe into long tidy dataframe, with a simple use case. Often while reshaping dataframe, you might want to reshape part of the columns in your data and keep one or more […]
Pandas Melt: Reshape Wide Data to Long/Tidy Data
Pandas offers multiple ways to reshape data in wide form to data in tidy or long form. Pandas melt() function is one of the powerful functions to use for reshaping dataframe with Python. In this case, we will see examples of basic use of Pandas melt to reshape wide data containing all numerical variables into […]
Pandas Groupby and Computing Median
One of the common operations of data analysis is group the data by a variable and compute some sumamry statistics on the sub-group of data. In this post, we will see an example of how to use groupby() function in Pandas to group a dataframe into multiple smaller dataframes and compute median on another variable […]