Posts

Showing posts from May, 2021

Classification code in python

https://www.kaggle.com/embed/drnitinmishra/classification-using-one-hot-encoding-exp-6?kernelSessionId=62599262

Function to Solve Null Value Problem-Filling Null Values

We wanted to create a function, which can fill missing values automatically. Our aim is to create a function that can take the data frame as input, finds the missing values, and fills the missing values with appropriate values.  So we have created our function, which will find out, numerical and categorical values from the data frame, then it will also find out which numerical and categorical values are missing.  It will fill those numerical and categorical values with different methods, numerical values will be filled with mean and categorical values will be filled with the most frequently occurring category. To Use this Function just pass pandas DataFrame to the function and it will do the rest. Suppose the data frame is d d=clean_missing(d) def clean_missing(df):     from sklearn.pipeline import Pipeline     from sklearn.impute import SimpleImputer     from sklearn.compose import ColumnTransformer     df_missing_values = df.isnull().s...