{"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","execution":{"iopub.status.busy":"2023-07-05T17:16:21.284365Z","iopub.execute_input":"2023-07-05T17:16:21.284980Z","iopub.status.idle":"2023-07-05T17:16:21.322303Z","shell.execute_reply.started":"2023-07-05T17:16:21.284946Z","shell.execute_reply":"2023-07-05T17:16:21.321293Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\ndf=pd.read_csv(\"/kaggle/input/stock-data/stock_data.csv\")\nprint(df)","metadata":{"execution":{"iopub.status.busy":"2023-07-05T17:16:46.203864Z","iopub.execute_input":"2023-07-05T17:16:46.204205Z","iopub.status.idle":"2023-07-05T17:16:46.251646Z","shell.execute_reply.started":"2023-07-05T17:16:46.204181Z","shell.execute_reply":"2023-07-05T17:16:46.250322Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.drop(columns='Unnamed: 0')","metadata":{"execution":{"iopub.status.busy":"2023-07-05T17:17:00.621012Z","iopub.execute_input":"2023-07-05T17:17:00.621386Z","iopub.status.idle":"2023-07-05T17:17:00.654715Z","shell.execute_reply.started":"2023-07-05T17:17:00.621357Z","shell.execute_reply":"2023-07-05T17:17:00.653671Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['Volume'].plot()","metadata":{"execution":{"iopub.status.busy":"2023-07-05T17:17:20.056479Z","iopub.execute_input":"2023-07-05T17:17:20.056892Z","iopub.status.idle":"2023-07-05T17:17:20.389464Z","shell.execute_reply.started":"2023-07-05T17:17:20.056859Z","shell.execute_reply":"2023-07-05T17:17:20.388372Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\ndf.plot(subplots=True, figsize=(4, 4))","metadata":{"execution":{"iopub.status.busy":"2023-07-05T17:17:40.162258Z","iopub.execute_input":"2023-07-05T17:17:40.162667Z","iopub.status.idle":"2023-07-05T17:17:41.689297Z","shell.execute_reply.started":"2023-07-05T17:17:40.162634Z","shell.execute_reply":"2023-07-05T17:17:41.688266Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.Low.diff(2).plot(figsize=(6, 6))","metadata":{"execution":{"iopub.status.busy":"2023-07-05T17:18:07.370695Z","iopub.execute_input":"2023-07-05T17:18:07.371379Z","iopub.status.idle":"2023-07-05T17:18:07.660603Z","shell.execute_reply.started":"2023-07-05T17:18:07.371283Z","shell.execute_reply":"2023-07-05T17:18:07.659548Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.High.diff(2).plot(figsize=(10, 6))","metadata":{"execution":{"iopub.status.busy":"2023-07-05T17:18:23.491246Z","iopub.execute_input":"2023-07-05T17:18:23.492146Z","iopub.status.idle":"2023-07-05T17:18:23.774008Z","shell.execute_reply.started":"2023-07-05T17:18:23.492109Z","shell.execute_reply":"2023-07-05T17:18:23.770893Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"window_size = 50\nrolling_mean = df['Open'].rolling\\\n\t\t\t(window_size).mean()\nrolling_mean.plot()","metadata":{"execution":{"iopub.status.busy":"2023-07-05T17:18:39.485993Z","iopub.execute_input":"2023-07-05T17:18:39.486394Z","iopub.status.idle":"2023-07-05T17:18:39.733553Z","shell.execute_reply.started":"2023-07-05T17:18:39.486362Z","shell.execute_reply":"2023-07-05T17:18:39.732590Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['Change'] = df.Close.div(df.Close.shift())\ndf['Change'].plot(figsize=(6, 6), fontsize=16)","metadata":{"execution":{"iopub.status.busy":"2023-07-05T17:18:55.703414Z","iopub.execute_input":"2023-07-05T17:18:55.703814Z","iopub.status.idle":"2023-07-05T17:18:55.998065Z","shell.execute_reply.started":"2023-07-05T17:18:55.703767Z","shell.execute_reply":"2023-07-05T17:18:55.996989Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['Change'].plot(figsize=(10, 6))\n","metadata":{"execution":{"iopub.status.busy":"2023-07-05T17:19:09.329240Z","iopub.execute_input":"2023-07-05T17:19:09.329617Z","iopub.status.idle":"2023-07-05T17:19:09.629686Z","shell.execute_reply.started":"2023-07-05T17:19:09.329587Z","shell.execute_reply":"2023-07-05T17:19:09.628622Z"},"trusted":true},"execution_count":null,"outputs":[]}]}