Replacing NaNs in a Dataframe Column with Mean
Python
Data Preprocessing
Uses the simple imputer in Sklearn to replace the NaNs in a dataframe column with the mean of the column.
1| from sklearn.impute import SimpleImputer 2| import numpy as np 3| 4| imputer = SimpleImputer(missing_values=np.nan, strategy='mean') 5| imputer.fit(df[column_name]) 6| df[column_name] = imputer.transform(df[columns_name]))
4
4
3
3
2
How to Remove Punctuation From Text with Python
Python
Data Preprocessing
Nlp | String | Punctuation
2
2
How to Create Different Aggregations Using GroupBy, Agg & Dictionaries
Python
Data Preprocessing
2
2
2