In this post, we will learn how to drop duplicate rows in a Pandas dataframe. We will use Pandas drop_duplicates() function to can delete duplicated rows with multiple examples. One of the common data cleaning tasks is to make a decision on how to deal with duplicate rows in a data frame. If the whole […]
Pandas DataFrame
Pandas query(): How to Filter Rows of Pandas Dataframe?
Pandas offer many ways to select rows from a dataframe. One of the commonly used approach to filter rows of a dataframe is to use the indexing in multiple ways. For example, one can use label based indexing with loc function. Introducing pandas query() function, Jake VanderPlas nicely explains, While these abstractions are efficient and […]
Pandas 0.25.0 is Here. What is New? Named aggregation, explode() and sparse dataframe
If you are like me, you might have missed that the fantastic Pandas team has released the new version Pandas 0.25.0. As one would expect, there are quite a few new things in Pandas 0.25.0. A couple of new enhancements are around pandas’ groupby aggregation. Here are a few new things that look really interesting. […]
How To Reshape Pandas Dataframe with melt and wide_to_long()?
Reshaping data frames into tidy format is probably one of the most frequent things you would do in data wrangling. In this post, we will learn how to use Pandas melt() function and wide_long_long() function to reshape Pandas dataframe in wide form to long tidy form. A data frame is tidy when it satisfies the […]
How To Create a Column Using Condition on Another Column in Pandas?
Often while cleaning data, one might want to create a new variable or column based on the values of another column using conditions. In this post we will see two different ways to create a column based on values of another column using conditional statements. First we will use NumPy’s little unknown function where to […]