The most advanced ML Observability product in the market
Building an ML platform is nothing like putting together Ikea furniture; obviously, Ikea is way more difficult. However, they both, similarly, include many different parts that help create value when put together. As every organization sets out on a unique path to building its own machine learning platform, taking on the project of building a […]
Start integrating our products and tools.
We’re excited 😁 to share that Forbes has named Aporia a Next Billion-Dollar Company. This recognition comes on the heels of our recent $25 million Series A funding and is a huge testament that Aporia’s mission and the need for trust in AI are more relevant than ever. We are very proud to be listed […]
NaN values are also called missing values and simply indicate the data we do not have. We do not like to have missing values in a dataset but it’s inevitable to have them in some cases.
The first step in handling missing values is to check how many they are. We often want to count the NaN values in a specific column to better understand the data.
This short how-to article will teach us how to count the missing values in Pandas and PySpark DataFrames.
We can use the isna or isnull function to detect missing values. They returned a DataFrame filled with boolean values (True or False) indicating the missing values. In order to count the missing values in each column separately, we need to use the sum function together with isna or isnull.
If we apply the sum function, we will get the number of the missing values in the DataFrame.
We can count the NaN values in each column separately in PySpark. The functions to use are select, count, when, and isnan.
The isnan function checks the condition of being NaN, the count, and when the functions count the rows in which the condition is True.