{"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":"import re\nimport pandas as pd\nimport numpy as np\nimport seaborn as sns\nimport matplotlib.pyplot as plt","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-04-22T14:30:36.229469Z","iopub.execute_input":"2022-04-22T14:30:36.229769Z","iopub.status.idle":"2022-04-22T14:30:36.23418Z","shell.execute_reply.started":"2022-04-22T14:30:36.229734Z","shell.execute_reply":"2022-04-22T14:30:36.233264Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('../input/ashrae-energy-prediction/weather_train.csv')","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:38.05994Z","iopub.execute_input":"2022-04-22T14:30:38.060737Z","iopub.status.idle":"2022-04-22T14:30:38.205753Z","shell.execute_reply.started":"2022-04-22T14:30:38.060687Z","shell.execute_reply":"2022-04-22T14:30:38.204926Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:39.22111Z","iopub.execute_input":"2022-04-22T14:30:39.221384Z","iopub.status.idle":"2022-04-22T14:30:39.244971Z","shell.execute_reply.started":"2022-04-22T14:30:39.221357Z","shell.execute_reply":"2022-04-22T14:30:39.24427Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.info()","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:39.701094Z","iopub.execute_input":"2022-04-22T14:30:39.7016Z","iopub.status.idle":"2022-04-22T14:30:39.72601Z","shell.execute_reply.started":"2022-04-22T14:30:39.701549Z","shell.execute_reply":"2022-04-22T14:30:39.725333Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"drop_col = ['cloud_coverage','precip_depth_1_hr']\ndf = df.drop(drop_col, axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:40.197486Z","iopub.execute_input":"2022-04-22T14:30:40.197969Z","iopub.status.idle":"2022-04-22T14:30:40.209479Z","shell.execute_reply.started":"2022-04-22T14:30:40.197921Z","shell.execute_reply":"2022-04-22T14:30:40.208478Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:40.578204Z","iopub.execute_input":"2022-04-22T14:30:40.578648Z","iopub.status.idle":"2022-04-22T14:30:40.598674Z","shell.execute_reply.started":"2022-04-22T14:30:40.578602Z","shell.execute_reply":"2022-04-22T14:30:40.597753Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.info()","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:41.023148Z","iopub.execute_input":"2022-04-22T14:30:41.023922Z","iopub.status.idle":"2022-04-22T14:30:41.044364Z","shell.execute_reply.started":"2022-04-22T14:30:41.023876Z","shell.execute_reply":"2022-04-22T14:30:41.043399Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def check_zeros(col):\n    return len(df[col==0])","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:41.433573Z","iopub.execute_input":"2022-04-22T14:30:41.434499Z","iopub.status.idle":"2022-04-22T14:30:41.440109Z","shell.execute_reply.started":"2022-04-22T14:30:41.434452Z","shell.execute_reply":"2022-04-22T14:30:41.439298Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"checked_cols = ['site_id','timestamp','air_temperature','dew_temperature','sea_level_pressure','wind_direction','wind_speed']\nfor col in checked_cols:\n    print(f'There are {check_zeros(df[col])} coloumns with zeros in {col}')","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:41.812413Z","iopub.execute_input":"2022-04-22T14:30:41.812696Z","iopub.status.idle":"2022-04-22T14:30:41.83924Z","shell.execute_reply.started":"2022-04-22T14:30:41.812666Z","shell.execute_reply":"2022-04-22T14:30:41.838056Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sum(df.duplicated())","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:42.212736Z","iopub.execute_input":"2022-04-22T14:30:42.213023Z","iopub.status.idle":"2022-04-22T14:30:42.266309Z","shell.execute_reply.started":"2022-04-22T14:30:42.212991Z","shell.execute_reply":"2022-04-22T14:30:42.265364Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df= df.replace(0, np.NAN)","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:42.635001Z","iopub.execute_input":"2022-04-22T14:30:42.635818Z","iopub.status.idle":"2022-04-22T14:30:42.64829Z","shell.execute_reply.started":"2022-04-22T14:30:42.635777Z","shell.execute_reply":"2022-04-22T14:30:42.64756Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for col in df:\n    print(f'There are {check_zeros(df[col])} rows with zero in {col}')","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:43.092464Z","iopub.execute_input":"2022-04-22T14:30:43.093203Z","iopub.status.idle":"2022-04-22T14:30:43.13048Z","shell.execute_reply.started":"2022-04-22T14:30:43.093151Z","shell.execute_reply":"2022-04-22T14:30:43.129914Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.dropna(subset = checked_cols, inplace = True)","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:43.5715Z","iopub.execute_input":"2022-04-22T14:30:43.571812Z","iopub.status.idle":"2022-04-22T14:30:43.594822Z","shell.execute_reply.started":"2022-04-22T14:30:43.571778Z","shell.execute_reply":"2022-04-22T14:30:43.594015Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def check_nan(col):\n\n    return sum(col.isnull())\nfor col in df:\n    print(f'There are {check_nan(df[col])} NaN in {col}')\nprint(f'\\nNow there are {df.shape[0]} rows with {df.shape[1]} columns')","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:44.069636Z","iopub.execute_input":"2022-04-22T14:30:44.069946Z","iopub.status.idle":"2022-04-22T14:30:44.148817Z","shell.execute_reply.started":"2022-04-22T14:30:44.069909Z","shell.execute_reply":"2022-04-22T14:30:44.147789Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.info()","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:44.648416Z","iopub.execute_input":"2022-04-22T14:30:44.648999Z","iopub.status.idle":"2022-04-22T14:30:44.673854Z","shell.execute_reply.started":"2022-04-22T14:30:44.648945Z","shell.execute_reply":"2022-04-22T14:30:44.673204Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot = df.boxplot(col, by=\"site_id\")\n\nplt.tight_layout() \n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:45.254675Z","iopub.execute_input":"2022-04-22T14:30:45.255296Z","iopub.status.idle":"2022-04-22T14:30:45.68353Z","shell.execute_reply.started":"2022-04-22T14:30:45.255247Z","shell.execute_reply":"2022-04-22T14:30:45.682539Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(df.corr(),linewidths=.5,cmap=\"YlGnBu\")","metadata":{"execution":{"iopub.status.busy":"2022-04-22T14:30:45.910265Z","iopub.execute_input":"2022-04-22T14:30:45.910951Z","iopub.status.idle":"2022-04-22T14:30:46.208779Z","shell.execute_reply.started":"2022-04-22T14:30:45.910903Z","shell.execute_reply":"2022-04-22T14:30:46.207656Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}