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 […]
Python
Principal Component Analysis with Penguins Data in Python
Who does not love PCA with Penguins in Python. Sorry, could not resist saying this :). If you are tired of seeing Iris data for introducing all things Machine Learning, Data Science algorithms and Data Visualization examples, you are in for much needed treat in the form of Penguins. Thanks to Alison Horst, who has […]
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 […]
How to Convert Wide Dataframe to Tidy Dataframe with Pandas stack()?
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 […]