Skip to Content

Missing Values in Pandas Category Column

In this tutorial, we will look at how to handle missing values in a category type column in Pandas with the help of some examples. The category type in Pandas is quite handy when working with categorical data. It takes a relatively smaller amount of memory (if there are a large number of repeated values …

Read More about Missing Values in Pandas Category Column

Join Category Columns with Pandas union_categoricals()

Pandas is a popular library for data manipulation in Python. It comes with a handy category dtype for categorical data. It also has useful functions to help you work with categorical data. In this tutorial, we will look at how to join two category type series in Pandas using the Pandas union_categoricals() function. Pandas concat() …

Read More about Join Category Columns with Pandas union_categoricals()

Concat Category Type Series in Pandas

In this tutorial, we will look at how to concat two category type Pandas series with the help of some examples. How to combine category type Pandas series? You can use the Pandas concat() function to combine two category type Pandas series. The following is the syntax – Combining series with the same categories results …

Read More about Concat Category Type Series in Pandas

Pandas Series.unique() vs Series.cat.categories

In this tutorial, we will look at the difference between the Pandas Series.unique() function and the Pandas Series.cat.categories attribute for a category type column. Difference between Pandas Series.unique() and Series.cat.categories The key difference is that, the pandas Series.unique() function gives us the unique value occurring in the data whereas the pandas.cat.categories property returns the possible …

Read More about Pandas Series.unique() vs Series.cat.categories

Compare Category Type Data in Pandas

The category dtype is used to store categorical values in Pandas. In this tutorial, we will look at how to compare data in a category type column in Pandas. Compare categorical data with other objects in Pandas There are three common use-cases for comparing category type data with other objects in Pandas. Compare category data …

Read More about Compare Category Type Data in Pandas

Pandas – Sort Dataframe on Category Column

In this tutorial, we will look at how to sort a Pandas dataframe based on values in a category type column with the help of some examples. How to sort a dataframe on a category column in Pandas? You can use the Pandas dataframe sort_values() function to sort a dataframe. Pass the category column name …

Read More about Pandas – Sort Dataframe on Category Column

Pandas – Category Column with Datetime Values

In this tutorial, we will look at how to convert a datetime type column to a category type column in Pandas and apply common datetime operations. How to convert datetime column to category type column in Pandas? You can use the Pandas astype() function to change the type of a column. To convert a column …

Read More about Pandas – Category Column with Datetime Values

Pandas – Apply String Functions to Category Column

In this tutorial, we will look at how to apply string functions to a category type column in Pandas with the help of some examples. How to apply string functions to a category type column? For appropriate category type columns in Pandas, you can use the .str accessor to apply string functions. The following is …

Read More about Pandas – Apply String Functions to Category Column