Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

simple imputer python

from sklearn.impute import SimpleImputer

imputer = SimpleImputer(strategy='median')

# for the entire df
df = pd.DataFrame(imputer.fit_transform(df), columns=df.columns)

# for specific column
df['Embarked'] = pd.DataFrame(imputer.fit_transform(pd.DataFrame(df['Embarked'], columns=['Embarked'])), columns=['Embarked'])
Comment

PREVIOUS NEXT
Code Example
Python :: check 32 or 64 bit python 
Python :: print traceback python 
Python :: requests download image 
Python :: matplotlib log 
Python :: how to check weather my model is on gpu in pytorch 
Python :: Extract images from html page based on src attribute using beatutiful soup 
Python :: ERROR: character with byte sequence 0xd0 0x9f in encoding "UTF8" has no equivalent in encoding "LATIN1" 
Python :: python list of random values 
Python :: python add datetime to filename 
Python :: importlib.reload not working 
Python :: show image in tkinter pillow 
Python :: python run server 
Python :: unzip in python 
Python :: download pdf from link using python 
Python :: python regex replace all non alphanumeric characters 
Python :: python convert nan to empty string 
Python :: python elif invalid syntax 
Python :: How to config your flask for gmail 
Python :: python number of cpus 
Python :: pandas how to get last index 
Python :: how to check if an application is open in python 
Python :: install multiprocessing python3 
Python :: pandas add dataframe to the bottom of another 
Python :: discord.py add role on member join 
Python :: pandas read_csv ignore unnamed columns 
Python :: change the current working directory in python 
Python :: import status in django rest framework 
Python :: python flask query params 
Python :: python time calculation 
Python :: convert seconds to hours python 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =