{"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":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport matplotlib.pyplot as plt\nimport seaborn as sns","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:10:43.629463Z","iopub.execute_input":"2023-04-07T11:10:43.630022Z","iopub.status.idle":"2023-04-07T11:10:44.801518Z","shell.execute_reply.started":"2023-04-07T11:10:43.629981Z","shell.execute_reply":"2023-04-07T11:10:44.800160Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data = pd.read_csv('/kaggle/input/icecube-neutrinos-in-deep-ice/sensor_geometry.csv')\ndata.head()","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:12:21.490116Z","iopub.execute_input":"2023-04-07T11:12:21.491292Z","iopub.status.idle":"2023-04-07T11:12:21.525977Z","shell.execute_reply.started":"2023-04-07T11:12:21.491225Z","shell.execute_reply":"2023-04-07T11:12:21.524638Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.info()","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:13:09.486263Z","iopub.execute_input":"2023-04-07T11:13:09.486774Z","iopub.status.idle":"2023-04-07T11:13:09.510268Z","shell.execute_reply.started":"2023-04-07T11:13:09.486732Z","shell.execute_reply":"2023-04-07T11:13:09.509092Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.corr()","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:13:26.388528Z","iopub.execute_input":"2023-04-07T11:13:26.389086Z","iopub.status.idle":"2023-04-07T11:13:26.406357Z","shell.execute_reply.started":"2023-04-07T11:13:26.389035Z","shell.execute_reply":"2023-04-07T11:13:26.404685Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#correlation map\nf,ax = plt.subplots(figsize=(15, 15))\nsns.heatmap(data.corr(), annot=True, linewidths=.5, fmt= '.1f',ax=ax)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:14:43.943587Z","iopub.execute_input":"2023-04-07T11:14:43.944369Z","iopub.status.idle":"2023-04-07T11:14:44.331530Z","shell.execute_reply.started":"2023-04-07T11:14:43.944318Z","shell.execute_reply":"2023-04-07T11:14:44.330393Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.head(10)","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:15:07.409079Z","iopub.execute_input":"2023-04-07T11:15:07.409577Z","iopub.status.idle":"2023-04-07T11:15:07.426804Z","shell.execute_reply.started":"2023-04-07T11:15:07.409534Z","shell.execute_reply":"2023-04-07T11:15:07.425377Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.columns","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:16:04.655214Z","iopub.execute_input":"2023-04-07T11:16:04.655661Z","iopub.status.idle":"2023-04-07T11:16:04.664095Z","shell.execute_reply.started":"2023-04-07T11:16:04.655625Z","shell.execute_reply":"2023-04-07T11:16:04.662580Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data._iter_column_arrays","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:16:28.177285Z","iopub.execute_input":"2023-04-07T11:16:28.177706Z","iopub.status.idle":"2023-04-07T11:16:28.197116Z","shell.execute_reply.started":"2023-04-07T11:16:28.177670Z","shell.execute_reply":"2023-04-07T11:16:28.195670Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data._sanitize_column","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:16:53.218157Z","iopub.execute_input":"2023-04-07T11:16:53.218589Z","iopub.status.idle":"2023-04-07T11:16:53.230894Z","shell.execute_reply.started":"2023-04-07T11:16:53.218554Z","shell.execute_reply":"2023-04-07T11:16:53.229386Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Line Plot\n# color = color, label = label,\ndata.x.plot(kind = 'line', color = 'g',label = 'x',linewidth=1,alpha = 0.5,grid = True,linestyle = ':')\ndata.y.plot(color = 'r',label = 'y',linewidth=1, alpha = 0.5,grid = True,linestyle = '-.')\nplt.xlabel('x axis')\nplt.ylabel('y axis')\nplt.title('Line Plot')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:18:55.928723Z","iopub.execute_input":"2023-04-07T11:18:55.930055Z","iopub.status.idle":"2023-04-07T11:18:56.241730Z","shell.execute_reply.started":"2023-04-07T11:18:55.930000Z","shell.execute_reply":"2023-04-07T11:18:56.240806Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Line Plot\n# color = color, label = label,\ndata.z.plot(kind = 'line', color = 'g',label = 'z',linewidth=1,alpha = 0.5,grid = True,linestyle = ':')\ndata.x.plot(color = 'r',label = 'x',linewidth=1, alpha = 0.5,grid = True,linestyle = '-.')\nplt.xlabel('x axis')\nplt.ylabel('y axis')\nplt.title('Line Plot')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:20:12.739102Z","iopub.execute_input":"2023-04-07T11:20:12.739651Z","iopub.status.idle":"2023-04-07T11:20:13.036346Z","shell.execute_reply.started":"2023-04-07T11:20:12.739609Z","shell.execute_reply":"2023-04-07T11:20:13.035369Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Scatter Plot \n# x = x, y = y\ndata.plot(kind='scatter', x='x', y='y',alpha = 0.5,color = 'red')\nplt.xlabel('x')              # label = name of label\nplt.ylabel('y')\nplt.title('x y Scatter Plot')","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:21:57.161644Z","iopub.execute_input":"2023-04-07T11:21:57.162731Z","iopub.status.idle":"2023-04-07T11:21:58.026445Z","shell.execute_reply.started":"2023-04-07T11:21:57.162661Z","shell.execute_reply":"2023-04-07T11:21:58.025572Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Scatter Plot \n# x = x, y = y\ndata.plot(kind='scatter', x='z', y='x',alpha = 0.5,color = 'red')\nplt.xlabel('z')              # label = name of label\nplt.ylabel('x')\nplt.title('z x Scatter Plot')","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:22:28.554658Z","iopub.execute_input":"2023-04-07T11:22:28.555912Z","iopub.status.idle":"2023-04-07T11:22:28.824498Z","shell.execute_reply.started":"2023-04-07T11:22:28.555852Z","shell.execute_reply":"2023-04-07T11:22:28.823281Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"threshold = sum(data.x)/len(data.x)\ndata[\"x_level\"] = [\"high\" if i > threshold else \"low\" for i in data.x]\ndata.loc[:5000,[\"x_level\",\"x\"]]","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:24:36.145381Z","iopub.execute_input":"2023-04-07T11:24:36.146024Z","iopub.status.idle":"2023-04-07T11:24:36.172969Z","shell.execute_reply.started":"2023-04-07T11:24:36.145973Z","shell.execute_reply":"2023-04-07T11:24:36.171594Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ax = plt.axes(projection='3d')\n\n# Data for a three-dimensional line\nzline = np.linspace(0, 15, 1000)\nxline = np.sin(zline)\nyline = np.cos(zline)\nax.plot3D(xline, yline, zline, 'gray')\n\n# Data for three-dimensional scattered points\nzdata = 15 * np.random.random(100)\nxdata = np.sin(zdata) + 0.1 * np.random.randn(100)\nydata = np.cos(zdata) + 0.1 * np.random.randn(100)\nax.scatter3D(xdata, ydata, zdata, c=zdata, cmap='Greens');","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:25:17.871925Z","iopub.execute_input":"2023-04-07T11:25:17.872431Z","iopub.status.idle":"2023-04-07T11:25:18.164821Z","shell.execute_reply.started":"2023-04-07T11:25:17.872390Z","shell.execute_reply":"2023-04-07T11:25:18.163227Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"r = np.arange(0, 2, 0.01)\ntheta = 2 * np.pi * r\n\nfig, ax = plt.subplots(subplot_kw={'projection': 'polar'})\nax.plot(theta, r)\nax.set_rmax(3)\nax.set_rticks([2.544000, 2.834000, 3.309000, 5.340750])  # Less radial ticks\nax.set_rlabel_position(-22.5)  # Move radial labels away from plotted line\nax.grid(True)\n\nax.set_title(\"A line plot on a polar axis\", va='bottom')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:27:19.202030Z","iopub.execute_input":"2023-04-07T11:27:19.202441Z","iopub.status.idle":"2023-04-07T11:27:19.683354Z","shell.execute_reply.started":"2023-04-07T11:27:19.202397Z","shell.execute_reply":"2023-04-07T11:27:19.682172Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Plotting all data \ndata1 = data.loc[:,[\"x\",\"y\",\"z\"]]\ndata1.plot()\n# it is confusing","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:29:18.269627Z","iopub.execute_input":"2023-04-07T11:29:18.270106Z","iopub.status.idle":"2023-04-07T11:29:18.726729Z","shell.execute_reply.started":"2023-04-07T11:29:18.270070Z","shell.execute_reply":"2023-04-07T11:29:18.725675Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import builtins\ndir(builtins)","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:35:30.192131Z","iopub.execute_input":"2023-04-07T11:35:30.192610Z","iopub.status.idle":"2023-04-07T11:35:30.204078Z","shell.execute_reply.started":"2023-04-07T11:35:30.192571Z","shell.execute_reply":"2023-04-07T11:35:30.202804Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Nested Function\n#function inside function\n","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#nested function\ndef square():\n    \"\"\" return square of value \"\"\"\n    def add():\n        \"\"\" add two local variable \"\"\"\n        x = -256.14\n        y = 57.20\n        z = x + y\n        return z\n    return add()**2\nprint(square())    ","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:43:26.344867Z","iopub.execute_input":"2023-04-07T11:43:26.345323Z","iopub.status.idle":"2023-04-07T11:43:26.352810Z","shell.execute_reply.started":"2023-04-07T11:43:26.345267Z","shell.execute_reply":"2023-04-07T11:43:26.351710Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data1.plot(subplots = True)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:50:58.063128Z","iopub.execute_input":"2023-04-07T11:50:58.063553Z","iopub.status.idle":"2023-04-07T11:50:58.504152Z","shell.execute_reply.started":"2023-04-07T11:50:58.063520Z","shell.execute_reply":"2023-04-07T11:50:58.503020Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data1.plot(kind = \"scatter\",x=\"z\",y = \"y\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:52:28.408120Z","iopub.execute_input":"2023-04-07T11:52:28.408934Z","iopub.status.idle":"2023-04-07T11:52:28.628392Z","shell.execute_reply.started":"2023-04-07T11:52:28.408893Z","shell.execute_reply":"2023-04-07T11:52:28.627027Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.describe()","metadata":{"execution":{"iopub.status.busy":"2023-04-07T11:57:15.682680Z","iopub.execute_input":"2023-04-07T11:57:15.683065Z","iopub.status.idle":"2023-04-07T11:57:15.709672Z","shell.execute_reply.started":"2023-04-07T11:57:15.683033Z","shell.execute_reply":"2023-04-07T11:57:15.708455Z"},"trusted":true},"execution_count":null,"outputs":[]}]}