Posts

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...

BASIC PANDAS FOR DATA ANALYSIS AND MACHINE LEARNING

Image
                         BASIC PANDAS FOR DATA ANALYSIS AND MACHINE LEARNING READING AND WRITING THE DATA df=pd.read_csv("/kaggle/input/heart.csv") df.to_csv("heart.csv") df.to_excel("heart.xls") xlsx = pd.ExcelFile("/kaggle/working/heart.xls")   Any data frame can be saved as a file. And any file can be read back to the data frame and vice versa. SELECTING DATA FROM DATA FRAME df.loc[1:10,["sex","chol","target"]] df[(df.target==1) | (df.sex==1)] df[(df.target==1) & (df.sex==1)] COUNTING 

Online Python Programming platforms

  No one wants to waste time in installation and package integration. So I am suggesting some online platforms where you can just log in and start programming. Google Colab https://www.kaggle.com Some Amazon products you can try Slippers Paragon chappals https://amzn.to/2MnhFE3

Fake news

https://www.summer.harvard.edu/inside-summer/4-tips-spotting-fake-news-story

Machine Learning Workflow

Image

Read data in google colab (pandas)

Read data in google colab from  google.colab  import  files uploaded = files.upload() import  io df = pd.read_csv(io.BytesIO(uploaded[ 'data.csv' ])) now the data is in df df[ 'diagnosis' ].value_counts() B 357 M 212 Name: diagnosis, dtype: int64 Some common operations in pandas df[ 'diagnosis' ].value_counts() B 357 M 212 Name: diagnosis, dtype: int64 ============================================================================== df[ 'diagnosis' ].unique() =============================================================================== df.groupby( 'area_mean' ).mean() ===============================================================================