Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to fillna in all columns with their mean values

# if you want to fill NaN in a single column with its mean value
df['col'].fillna(df['col'].mean(), inplace=True)

# if you want to fill NaN in more than one columns with their respective mean values
df.fillna(df.mean(), inplace=True)
Comment

how to fillna in all columns with their mean values

# if you want to fill NaN in a single column with its mean value
df['col'].fillna(df['col'].mean(), inplace=True)

# if you want to fill NaN in more than one columns with their respective mean values
df.fillna(df.mean(), inplace=True)
Comment

PREVIOUS NEXT
Code Example
Python :: pandas loop through rows 
Python :: sklearn.utils.bunch to dataframe 
Python :: how to make a tkinter window 
Python :: export file csv 
Python :: pandas read_csv ignore first column 
Python :: python listdir with full paths 
Python :: python get all variables in class 
Python :: generate a color python 
Python :: convert string list to float 
Python :: pandas tuple from two columns 
Python :: pandas add days to date 
Python :: parse datetime python 
Python :: pandas select all columns except one 
Python :: python delete none from list 
Python :: check if a number is perfect cube in python 
Python :: python sleep 5 seconds 
Python :: pyqt5 set window icon 
Python :: how to import login required in django 
Python :: python click buttons on websites 
Python :: get file name from url python 
Python :: matplotlib plot title font size 
Python :: python bytes to dict 
Python :: django model plural 
Python :: django add media 
Python :: save and load a dictionary python 
Python :: check gpu in tensorflow 
Python :: python - give a name to index column 
Python :: python selenium switch to window 
Python :: frequency count of values in pandas dataframe 
Python :: how to get latitude and longitude from address in python 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =