Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

impute mode pandas

cols = ["workclass", "native-country"]
df[cols]=df[cols].fillna(df.mode().iloc[0])
Comment

PREVIOUS NEXT
Code Example
Python :: pandas add list to dataframe as column 
Python :: random python 
Python :: python convert exponential to int 
Python :: fixed precision float python 
Python :: delete spaces in string python 
Python :: how to switch driver in python selenium 
Python :: how to download nltk in python 
Python :: difference of two set in python 
Python :: series.Series to dataframe 
Python :: tkinter yes no dialogue box 
Python :: choromap = go.Figure(data=[data], layout = layout) 
Python :: or operator in django queryset 
Python :: drop a row with a specific value of a column 
Python :: python add element to array 
Python :: named tuple python iterate 
Python :: pandas select columns by index list 
Python :: remove spaces in string python 
Python :: strings are immutable in python 
Python :: pandas index from 1 
Python :: numpy sort array by another array 
Python :: how to get a hyperlink in django 
Python :: python log10 
Python :: python remove spaces 
Python :: circumference of circle 
Python :: sort dict by values 
Python :: python print numbers 1 to 10 in one line 
Python :: as type in pandas 
Python :: how to append list to list in python 
Python :: download image from url python 3 
Python :: create column for year in dataframe python 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =