Answers for "how to find empty rows of a dataset in python"

0

how to find empty rows of a dataset in python

import numpy as np                             # to use np.nan 
import pandas as pd                            # to use replace
    
df = df.replace(' ', np.nan)                   # to get rid of empty values
nan_values = df[df.isna().any(axis=1)]         # to get all rows with Na

nan_values                                     # view df with NaN rows only
Posted by: Guest on August-17-2021

Code answers related to "how to find empty rows of a dataset in python"

Python Answers by Framework

Browse Popular Code Answers by Language