{"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":"","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-11-06T12:33:32.690531Z","iopub.execute_input":"2021-11-06T12:33:32.690986Z","iopub.status.idle":"2021-11-06T12:33:32.717325Z","shell.execute_reply.started":"2021-11-06T12:33:32.69088Z","shell.execute_reply":"2021-11-06T12:33:32.716614Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd","metadata":{"execution":{"iopub.status.busy":"2021-11-07T19:12:15.310039Z","iopub.execute_input":"2021-11-07T19:12:15.310492Z","iopub.status.idle":"2021-11-07T19:12:15.338846Z","shell.execute_reply.started":"2021-11-07T19:12:15.310374Z","shell.execute_reply":"2021-11-07T19:12:15.337614Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Data Reading\ntime_series = pd.read_csv(\"../input/g-research-crypto-forecasting/train.csv\")\nasset_deatials = pd.read_csv(\"../input/g-research-crypto-forecasting/asset_details.csv\")\ntest_data = pd.read_csv(\"../input/g-research-crypto-forecasting/example_test.csv\")\nasset_details = pd.read_csv(\"../input/g-research-crypto-forecasting/asset_details.csv\")","metadata":{"execution":{"iopub.status.busy":"2021-11-07T19:12:40.0464Z","iopub.execute_input":"2021-11-07T19:12:40.046705Z","iopub.status.idle":"2021-11-07T19:13:40.14894Z","shell.execute_reply.started":"2021-11-07T19:12:40.046672Z","shell.execute_reply":"2021-11-07T19:13:40.148333Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Quick view on data\nprint(time_series.head(2))\nprint(time_series.tail(2))","metadata":{"execution":{"iopub.status.busy":"2021-11-07T19:13:55.826441Z","iopub.execute_input":"2021-11-07T19:13:55.826928Z","iopub.status.idle":"2021-11-07T19:13:55.84809Z","shell.execute_reply.started":"2021-11-07T19:13:55.826872Z","shell.execute_reply":"2021-11-07T19:13:55.847431Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# converting unix number to to datetime format for better understanding\ndef to_date_time(data, var,units):\n    return pd.to_datetime(data[var],unit=units)\n\n# updating on master data(train)\ndata_time = to_date_time(time_series,\"timestamp\",\"s\")\ntime_series['timestamp']  = data_time","metadata":{"execution":{"iopub.status.busy":"2021-11-07T19:14:01.908683Z","iopub.execute_input":"2021-11-07T19:14:01.909236Z","iopub.status.idle":"2021-11-07T19:14:03.373997Z","shell.execute_reply.started":"2021-11-07T19:14:01.909175Z","shell.execute_reply":"2021-11-07T19:14:03.373141Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Quick view on data after formating date_time\n# date format - YYYY - MM - DD\n# Top 2\ntime_series.head(2)","metadata":{"execution":{"iopub.status.busy":"2021-11-07T19:14:08.897991Z","iopub.execute_input":"2021-11-07T19:14:08.898271Z","iopub.status.idle":"2021-11-07T19:14:08.921734Z","shell.execute_reply.started":"2021-11-07T19:14:08.898242Z","shell.execute_reply":"2021-11-07T19:14:08.920236Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Quick view on data after formating date_time\n# date format - YYYY - MM - DD\n# Bottom 2\ntime_series.tail(2)","metadata":{"execution":{"iopub.status.busy":"2021-11-07T19:14:12.173467Z","iopub.execute_input":"2021-11-07T19:14:12.173783Z","iopub.status.idle":"2021-11-07T19:14:12.189541Z","shell.execute_reply.started":"2021-11-07T19:14:12.173753Z","shell.execute_reply":"2021-11-07T19:14:12.188717Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# updating on master data(train)\ndata_time_test = to_date_time(test_data,\"timestamp\",\"s\")\ntest_data['timestamp']  = data_time_test","metadata":{"execution":{"iopub.status.busy":"2021-11-07T19:15:13.426074Z","iopub.execute_input":"2021-11-07T19:15:13.426429Z","iopub.status.idle":"2021-11-07T19:15:13.434919Z","shell.execute_reply.started":"2021-11-07T19:15:13.426391Z","shell.execute_reply":"2021-11-07T19:15:13.433779Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Numerical variable to categorical - Assest_name\nasset_details = (pd.Series(asset_details[\"Asset_Name\"].values, index=asset_details[\"Asset_ID\"])).to_dict()\ntime_series[\"Asset_ID\"] = time_series[\"Asset_ID\"].map(asset_details)\ntime_series.head(10)","metadata":{"execution":{"iopub.status.busy":"2021-11-07T19:15:29.87752Z","iopub.execute_input":"2021-11-07T19:15:29.878308Z","iopub.status.idle":"2021-11-07T19:15:30.381538Z","shell.execute_reply.started":"2021-11-07T19:15:29.878248Z","shell.execute_reply":"2021-11-07T19:15:30.380893Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Descriptive Statistics**\n\nFor better understanding performing various descriptive statistics \n     \n* Measures of Central Tendency\n* Measures of Dispersion\n* Measures of Dsitribution","metadata":{}},{"cell_type":"code","source":"# Measures of Central Tendency\nprint(\"******** Mean *********\")\nprint(time_series.groupby(\"Asset_ID\").mean(),\"\\n\")\nprint(\"********* Standar Deviation ***********\\n\")\nprint(time_series.groupby(\"Asset_ID\").std(),\"\\n\")\nprint(\"********* Variance ***********\\n\")\nprint(time_series.groupby(\"Asset_ID\").var())","metadata":{"execution":{"iopub.status.busy":"2021-11-07T19:15:34.312517Z","iopub.execute_input":"2021-11-07T19:15:34.313507Z","iopub.status.idle":"2021-11-07T19:15:45.39219Z","shell.execute_reply.started":"2021-11-07T19:15:34.313454Z","shell.execute_reply":"2021-11-07T19:15:45.39136Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Worked upto basic analysis.. Next stage will be Data Exploration**","metadata":{}},{"cell_type":"code","source":"# Data Visualization\nimport ploty.express as px","metadata":{"execution":{"iopub.status.busy":"2021-11-07T07:56:36.865888Z","iopub.execute_input":"2021-11-07T07:56:36.866485Z","iopub.status.idle":"2021-11-07T07:56:36.956461Z","shell.execute_reply.started":"2021-11-07T07:56:36.866338Z","shell.execute_reply":"2021-11-07T07:56:36.955296Z"},"trusted":true},"execution_count":null,"outputs":[]}]}