{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"#Label Encoding:Label Encoding refers to converting the labels into a numeric form so as to convert them into the machine-readable form","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-03-09T09:14:59.859748Z","iopub.execute_input":"2023-03-09T09:14:59.861333Z","iopub.status.idle":"2023-03-09T09:14:59.866314Z","shell.execute_reply.started":"2023-03-09T09:14:59.861262Z","shell.execute_reply":"2023-03-09T09:14:59.865077Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#type of Label encoding\n#1)Dummy label encoding\n#2) ordinary/on hot label encoding\n#3) map\n#4)Binary \n#5)Frequency\n#6)Feature hashing","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:36:54.018024Z","iopub.execute_input":"2023-03-09T09:36:54.018473Z","iopub.status.idle":"2023-03-09T09:36:54.023002Z","shell.execute_reply.started":"2023-03-09T09:36:54.018438Z","shell.execute_reply":"2023-03-09T09:36:54.022028Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:37:54.114129Z","iopub.execute_input":"2023-03-09T09:37:54.114544Z","iopub.status.idle":"2023-03-09T09:37:54.124229Z","shell.execute_reply.started":"2023-03-09T09:37:54.114506Z","shell.execute_reply":"2023-03-09T09:37:54.123139Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset=pd.read_csv(\"/kaggle/input/corona-virus-report/country_wise_latest.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:41:50.193628Z","iopub.execute_input":"2023-03-09T09:41:50.194044Z","iopub.status.idle":"2023-03-09T09:41:50.226617Z","shell.execute_reply.started":"2023-03-09T09:41:50.194008Z","shell.execute_reply":"2023-03-09T09:41:50.225243Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:41:50.707007Z","iopub.execute_input":"2023-03-09T09:41:50.707441Z","iopub.status.idle":"2023-03-09T09:41:50.738496Z","shell.execute_reply.started":"2023-03-09T09:41:50.707400Z","shell.execute_reply":"2023-03-09T09:41:50.737323Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset.shape","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:42:06.656883Z","iopub.execute_input":"2023-03-09T09:42:06.657433Z","iopub.status.idle":"2023-03-09T09:42:06.666076Z","shell.execute_reply.started":"2023-03-09T09:42:06.657377Z","shell.execute_reply":"2023-03-09T09:42:06.664635Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:42:21.224053Z","iopub.execute_input":"2023-03-09T09:42:21.224486Z","iopub.status.idle":"2023-03-09T09:42:21.235254Z","shell.execute_reply.started":"2023-03-09T09:42:21.224447Z","shell.execute_reply":"2023-03-09T09:42:21.234013Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset=pd.read_csv(\"/kaggle/input/corona-virus-report/covid_19_clean_complete.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:43:31.133614Z","iopub.execute_input":"2023-03-09T09:43:31.134034Z","iopub.status.idle":"2023-03-09T09:43:31.252889Z","shell.execute_reply.started":"2023-03-09T09:43:31.133991Z","shell.execute_reply":"2023-03-09T09:43:31.251871Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:43:39.882282Z","iopub.execute_input":"2023-03-09T09:43:39.882665Z","iopub.status.idle":"2023-03-09T09:43:39.905027Z","shell.execute_reply.started":"2023-03-09T09:43:39.882629Z","shell.execute_reply":"2023-03-09T09:43:39.903644Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset.shape","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:43:57.857671Z","iopub.execute_input":"2023-03-09T09:43:57.858103Z","iopub.status.idle":"2023-03-09T09:43:57.865689Z","shell.execute_reply.started":"2023-03-09T09:43:57.858068Z","shell.execute_reply":"2023-03-09T09:43:57.864507Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:44:14.877948Z","iopub.execute_input":"2023-03-09T09:44:14.878510Z","iopub.status.idle":"2023-03-09T09:44:14.911397Z","shell.execute_reply.started":"2023-03-09T09:44:14.878456Z","shell.execute_reply":"2023-03-09T09:44:14.910093Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset[\"WHO Region\"].unique()","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:45:13.741638Z","iopub.execute_input":"2023-03-09T09:45:13.742880Z","iopub.status.idle":"2023-03-09T09:45:13.757432Z","shell.execute_reply.started":"2023-03-09T09:45:13.742817Z","shell.execute_reply":"2023-03-09T09:45:13.755778Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset[\"WHO Region\"].nunique()","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:45:31.770378Z","iopub.execute_input":"2023-03-09T09:45:31.770970Z","iopub.status.idle":"2023-03-09T09:45:31.785469Z","shell.execute_reply.started":"2023-03-09T09:45:31.770914Z","shell.execute_reply":"2023-03-09T09:45:31.783733Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#working with label encoding","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:55:33.128397Z","iopub.execute_input":"2023-03-09T09:55:33.128867Z","iopub.status.idle":"2023-03-09T09:55:33.133940Z","shell.execute_reply.started":"2023-03-09T09:55:33.128823Z","shell.execute_reply":"2023-03-09T09:55:33.132619Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.preprocessing import LabelEncoder\nlb1=LabelEncoder()\ndataset[\"WHO Region\"]=lb1.fit_transform(dataset[\"WHO Region\"])","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:55:33.851586Z","iopub.execute_input":"2023-03-09T09:55:33.852488Z","iopub.status.idle":"2023-03-09T09:55:33.863739Z","shell.execute_reply.started":"2023-03-09T09:55:33.852436Z","shell.execute_reply":"2023-03-09T09:55:33.862428Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:55:36.187019Z","iopub.execute_input":"2023-03-09T09:55:36.187442Z","iopub.status.idle":"2023-03-09T09:55:36.209229Z","shell.execute_reply.started":"2023-03-09T09:55:36.187403Z","shell.execute_reply":"2023-03-09T09:55:36.207927Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Dummy Variables","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:55:55.575206Z","iopub.execute_input":"2023-03-09T09:55:55.575667Z","iopub.status.idle":"2023-03-09T09:55:55.581320Z","shell.execute_reply.started":"2023-03-09T09:55:55.575627Z","shell.execute_reply":"2023-03-09T09:55:55.580009Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset[\"Country/Region\"].value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:57:03.972843Z","iopub.execute_input":"2023-03-09T09:57:03.973251Z","iopub.status.idle":"2023-03-09T09:57:03.989363Z","shell.execute_reply.started":"2023-03-09T09:57:03.973215Z","shell.execute_reply":"2023-03-09T09:57:03.987870Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.get_dummies(dataset[\"Country/Region\"])","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:57:41.492591Z","iopub.execute_input":"2023-03-09T09:57:41.493053Z","iopub.status.idle":"2023-03-09T09:57:41.542045Z","shell.execute_reply.started":"2023-03-09T09:57:41.493011Z","shell.execute_reply":"2023-03-09T09:57:41.540785Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset[\"Country/Region\"].unique()","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:58:54.400110Z","iopub.execute_input":"2023-03-09T09:58:54.400785Z","iopub.status.idle":"2023-03-09T09:58:54.423659Z","shell.execute_reply.started":"2023-03-09T09:58:54.400704Z","shell.execute_reply":"2023-03-09T09:58:54.419704Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset[\"Country/Region\"].nunique()","metadata":{"execution":{"iopub.status.busy":"2023-03-09T09:59:15.715241Z","iopub.execute_input":"2023-03-09T09:59:15.715669Z","iopub.status.idle":"2023-03-09T09:59:15.728541Z","shell.execute_reply.started":"2023-03-09T09:59:15.715628Z","shell.execute_reply":"2023-03-09T09:59:15.726976Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset=pd.read_csv(\"/kaggle/input/corona-virus-report/worldometer_data.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-03-09T10:02:05.272713Z","iopub.execute_input":"2023-03-09T10:02:05.273156Z","iopub.status.idle":"2023-03-09T10:02:05.292885Z","shell.execute_reply.started":"2023-03-09T10:02:05.273105Z","shell.execute_reply":"2023-03-09T10:02:05.291597Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset","metadata":{"execution":{"iopub.status.busy":"2023-03-09T10:02:05.865161Z","iopub.execute_input":"2023-03-09T10:02:05.866376Z","iopub.status.idle":"2023-03-09T10:02:05.900975Z","shell.execute_reply.started":"2023-03-09T10:02:05.866317Z","shell.execute_reply":"2023-03-09T10:02:05.899407Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset.describe()","metadata":{"execution":{"iopub.status.busy":"2023-03-09T10:30:09.669881Z","iopub.execute_input":"2023-03-09T10:30:09.671041Z","iopub.status.idle":"2023-03-09T10:30:09.735452Z","shell.execute_reply.started":"2023-03-09T10:30:09.670974Z","shell.execute_reply":"2023-03-09T10:30:09.734229Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset.info()","metadata":{"execution":{"iopub.status.busy":"2023-03-09T10:30:30.512116Z","iopub.execute_input":"2023-03-09T10:30:30.512519Z","iopub.status.idle":"2023-03-09T10:30:30.533037Z","shell.execute_reply.started":"2023-03-09T10:30:30.512485Z","shell.execute_reply":"2023-03-09T10:30:30.532140Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# map","metadata":{"execution":{"iopub.status.busy":"2023-03-09T10:20:43.840293Z","iopub.execute_input":"2023-03-09T10:20:43.841716Z","iopub.status.idle":"2023-03-09T10:20:43.846936Z","shell.execute_reply.started":"2023-03-09T10:20:43.841627Z","shell.execute_reply":"2023-03-09T10:20:43.845595Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"d={\n    \"Gender\":[\"male\",\"female\",\"male\",\"female\",\"male\",\"female\",\"male\",\"female\",\"male\",\"male\",\"female\",\"female\"]\n}\ndata=pd.DataFrame(d)","metadata":{"execution":{"iopub.status.busy":"2023-03-09T10:23:27.852789Z","iopub.execute_input":"2023-03-09T10:23:27.853186Z","iopub.status.idle":"2023-03-09T10:23:27.861082Z","shell.execute_reply.started":"2023-03-09T10:23:27.853151Z","shell.execute_reply":"2023-03-09T10:23:27.859561Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data","metadata":{"execution":{"iopub.status.busy":"2023-03-09T10:23:32.390677Z","iopub.execute_input":"2023-03-09T10:23:32.391116Z","iopub.status.idle":"2023-03-09T10:23:32.402292Z","shell.execute_reply.started":"2023-03-09T10:23:32.391075Z","shell.execute_reply":"2023-03-09T10:23:32.401006Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=data[\"Gender\"].map({'male':0,'female':1})","metadata":{"execution":{"iopub.status.busy":"2023-03-09T10:24:57.224025Z","iopub.execute_input":"2023-03-09T10:24:57.224433Z","iopub.status.idle":"2023-03-09T10:24:57.231418Z","shell.execute_reply.started":"2023-03-09T10:24:57.224398Z","shell.execute_reply":"2023-03-09T10:24:57.230187Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data","metadata":{"execution":{"iopub.status.busy":"2023-03-09T10:25:06.155500Z","iopub.execute_input":"2023-03-09T10:25:06.155939Z","iopub.status.idle":"2023-03-09T10:25:06.164624Z","shell.execute_reply.started":"2023-03-09T10:25:06.155899Z","shell.execute_reply":"2023-03-09T10:25:06.163222Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}