Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

find all nan columns pandas

nan_cols = [i for i in df.columns if df[i].isnull().any()]
print("No. of columns containing null values")
print(len(df.columns[df.isna().any()]))

print("No. of columns not containing null values")
print(len(df.columns[df.notna().all()]))

print("Total no. of columns in the dataframe")
print(len(df.columns))
Comment

pandas search for nan in column

df['your column name'].isnull().values.any()
Comment

PREVIOUS NEXT
Code Example
Python :: python read and delete line from file 
Python :: python script to read all file names in a folder 
Python :: django modelform style 
Python :: random hex color python 
Python :: extract minutes from timedelta python 
Python :: binary string to hex python 
Python :: install python 3.9 centos8 
Python :: pyspark case when 
Python :: breaking big csv into chunks pandas 
Python :: raise python 
Python :: default ordering django 
Python :: one hot encoding numpy 
Python :: move mouse round in python 
Python :: selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable 
Python :: pandas drop rows with value in list 
Python :: python dict dot notation 
Python :: request.body django 
Python :: Get a random joke in python 
Python :: ipython on cmd 
Python :: python copy dataframe 
Python :: where to import kivy builder 
Python :: star pattern in python 
Python :: convert x unicode utf 8 bytes to u python 
Python :: variable naming rule in python 
Python :: converting month number to month name python 
Python :: pandas string to number 
Python :: reverse python dict 
Python :: how to use sum with range python 
Python :: create virtual env 
Python :: convex hull algorithm python 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =