{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import plotly.express as px" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "df_apple = pd.read_csv('../coal-price-data/investing/AAPL Historical Data.csv')\n", "df_walmart = pd.read_csv('../coal-price-data/investing/WMT Historical Data.csv')\n", "df_tesla = pd.read_csv('../coal-price-data/investing/TSLA Historical Data.csv')" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DatePriceOpenHighLowVol.Change %
002/01/2024182.52183.97191.00179.2645.12M-1.02%
101/01/2024184.40187.15196.38180.171.19B-4.22%
212/01/2023192.53190.33199.62187.451.06B1.36%
311/01/2023189.95171.00192.93170.121.10B11.23%
410/01/2023170.77171.22182.34165.671.17B-0.26%
........................
51305/01/19810.150.130.150.12590.42M15.38%
51404/01/19810.130.110.130.11536.93M18.18%
51503/01/19810.110.120.120.10700.72M-8.33%
51602/01/19810.120.120.130.11321.62M-7.69%
51701/01/19810.130.150.160.13608.99M-13.33%
\n", "

518 rows × 7 columns

\n", "
" ], "text/plain": [ " Date Price Open High Low Vol. Change %\n", "0 02/01/2024 182.52 183.97 191.00 179.26 45.12M -1.02%\n", "1 01/01/2024 184.40 187.15 196.38 180.17 1.19B -4.22%\n", "2 12/01/2023 192.53 190.33 199.62 187.45 1.06B 1.36%\n", "3 11/01/2023 189.95 171.00 192.93 170.12 1.10B 11.23%\n", "4 10/01/2023 170.77 171.22 182.34 165.67 1.17B -0.26%\n", ".. ... ... ... ... ... ... ...\n", "513 05/01/1981 0.15 0.13 0.15 0.12 590.42M 15.38%\n", "514 04/01/1981 0.13 0.11 0.13 0.11 536.93M 18.18%\n", "515 03/01/1981 0.11 0.12 0.12 0.10 700.72M -8.33%\n", "516 02/01/1981 0.12 0.12 0.13 0.11 321.62M -7.69%\n", "517 01/01/1981 0.13 0.15 0.16 0.13 608.99M -13.33%\n", "\n", "[518 rows x 7 columns]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_apple" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "df = pd.merge(df_apple[['Date', 'Price']], df_walmart[['Date', 'Price']], on='Date', how='right').rename(columns = {'Adj Close_x':'apple', 'Adj Close_y':'walmart'})\n", "df = df.merge(df_tesla[['Date', 'Price']], on='Date', how='right').rename(columns={'Adj Close':'tesla'})" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DatePrice_xPrice_yPrice
002/01/2024182.52175.56191.97
101/01/2024184.40165.25187.29
212/01/2023192.53157.65248.48
311/01/2023189.95155.69240.08
410/01/2023170.77163.41200.84
...............
15911/01/201011.1154.092.36
16010/01/201010.7554.171.46
16109/01/201010.1353.521.36
16208/01/20108.6850.141.30
16307/01/20109.1951.191.33
\n", "

164 rows × 4 columns

\n", "
" ], "text/plain": [ " Date Price_x Price_y Price\n", "0 02/01/2024 182.52 175.56 191.97\n", "1 01/01/2024 184.40 165.25 187.29\n", "2 12/01/2023 192.53 157.65 248.48\n", "3 11/01/2023 189.95 155.69 240.08\n", "4 10/01/2023 170.77 163.41 200.84\n", ".. ... ... ... ...\n", "159 11/01/2010 11.11 54.09 2.36\n", "160 10/01/2010 10.75 54.17 1.46\n", "161 09/01/2010 10.13 53.52 1.36\n", "162 08/01/2010 8.68 50.14 1.30\n", "163 07/01/2010 9.19 51.19 1.33\n", "\n", "[164 rows x 4 columns]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "df['Date'] = pd.to_datetime(df['Date'])" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DatePrice_xPrice_yPrice
02024-02-01182.52175.56191.97
12024-01-01184.40165.25187.29
22023-12-01192.53157.65248.48
32023-11-01189.95155.69240.08
42023-10-01170.77163.41200.84
...............
1592010-11-0111.1154.092.36
1602010-10-0110.7554.171.46
1612010-09-0110.1353.521.36
1622010-08-018.6850.141.30
1632010-07-019.1951.191.33
\n", "

164 rows × 4 columns

\n", "
" ], "text/plain": [ " Date Price_x Price_y Price\n", "0 2024-02-01 182.52 175.56 191.97\n", "1 2024-01-01 184.40 165.25 187.29\n", "2 2023-12-01 192.53 157.65 248.48\n", "3 2023-11-01 189.95 155.69 240.08\n", "4 2023-10-01 170.77 163.41 200.84\n", ".. ... ... ... ...\n", "159 2010-11-01 11.11 54.09 2.36\n", "160 2010-10-01 10.75 54.17 1.46\n", "161 2010-09-01 10.13 53.52 1.36\n", "162 2010-08-01 8.68 50.14 1.30\n", "163 2010-07-01 9.19 51.19 1.33\n", "\n", "[164 rows x 4 columns]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "df = df.set_index('Date').rename_axis('company', axis=1)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
companyPrice_xPrice_yPrice
Date
2024-02-01182.52175.56191.97
2024-01-01184.40165.25187.29
2023-12-01192.53157.65248.48
2023-11-01189.95155.69240.08
2023-10-01170.77163.41200.84
............
2010-11-0111.1154.092.36
2010-10-0110.7554.171.46
2010-09-0110.1353.521.36
2010-08-018.6850.141.30
2010-07-019.1951.191.33
\n", "

164 rows × 3 columns

\n", "
" ], "text/plain": [ "company Price_x Price_y Price\n", "Date \n", "2024-02-01 182.52 175.56 191.97\n", "2024-01-01 184.40 165.25 187.29\n", "2023-12-01 192.53 157.65 248.48\n", "2023-11-01 189.95 155.69 240.08\n", "2023-10-01 170.77 163.41 200.84\n", "... ... ... ...\n", "2010-11-01 11.11 54.09 2.36\n", "2010-10-01 10.75 54.17 1.46\n", "2010-09-01 10.13 53.52 1.36\n", "2010-08-01 8.68 50.14 1.30\n", "2010-07-01 9.19 51.19 1.33\n", "\n", "[164 rows x 3 columns]" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "company=Price_x
Date=%{x}
value=%{y}", "legendgroup": "Price_x", "line": { "color": "#636efa", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Price_x", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2024-02-01T00:00:00", "2024-01-01T00:00:00", "2023-12-01T00:00:00", "2023-11-01T00:00:00", "2023-10-01T00:00:00", "2023-09-01T00:00:00", "2023-08-01T00:00:00", "2023-07-01T00:00:00", "2023-06-01T00:00:00", "2023-05-01T00:00:00", "2023-04-01T00:00:00", "2023-03-01T00:00:00", "2023-02-01T00:00:00", "2023-01-01T00:00:00", "2022-12-01T00:00:00", "2022-11-01T00:00:00", "2022-10-01T00:00:00", "2022-09-01T00:00:00", "2022-08-01T00:00:00", "2022-07-01T00:00:00", "2022-06-01T00:00:00", "2022-05-01T00:00:00", "2022-04-01T00:00:00", "2022-03-01T00:00:00", "2022-02-01T00:00:00", "2022-01-01T00:00:00", "2021-12-01T00:00:00", "2021-11-01T00:00:00", "2021-10-01T00:00:00", "2021-09-01T00:00:00", "2021-08-01T00:00:00", "2021-07-01T00:00:00", "2021-06-01T00:00:00", "2021-05-01T00:00:00", "2021-04-01T00:00:00", "2021-03-01T00:00:00", "2021-02-01T00:00:00", "2021-01-01T00:00:00", "2020-12-01T00:00:00", "2020-11-01T00:00:00", "2020-10-01T00:00:00", "2020-09-01T00:00:00", "2020-08-01T00:00:00", "2020-07-01T00:00:00", "2020-06-01T00:00:00", "2020-05-01T00:00:00", "2020-04-01T00:00:00", "2020-03-01T00:00:00", "2020-02-01T00:00:00", "2020-01-01T00:00:00", "2019-12-01T00:00:00", "2019-11-01T00:00:00", "2019-10-01T00:00:00", "2019-09-01T00:00:00", "2019-08-01T00:00:00", "2019-07-01T00:00:00", "2019-06-01T00:00:00", "2019-05-01T00:00:00", "2019-04-01T00:00:00", "2019-03-01T00:00:00", "2019-02-01T00:00:00", "2019-01-01T00:00:00", "2018-12-01T00:00:00", "2018-11-01T00:00:00", "2018-10-01T00:00:00", "2018-09-01T00:00:00", "2018-08-01T00:00:00", "2018-07-01T00:00:00", "2018-06-01T00:00:00", "2018-05-01T00:00:00", "2018-04-01T00:00:00", "2018-03-01T00:00:00", "2018-02-01T00:00:00", "2018-01-01T00:00:00", "2017-12-01T00:00:00", "2017-11-01T00:00:00", "2017-10-01T00:00:00", "2017-09-01T00:00:00", "2017-08-01T00:00:00", "2017-07-01T00:00:00", "2017-06-01T00:00:00", "2017-05-01T00:00:00", "2017-04-01T00:00:00", "2017-03-01T00:00:00", "2017-02-01T00:00:00", "2017-01-01T00:00:00", "2016-12-01T00:00:00", "2016-11-01T00:00:00", "2016-10-01T00:00:00", "2016-09-01T00:00:00", "2016-08-01T00:00:00", "2016-07-01T00:00:00", "2016-06-01T00:00:00", "2016-05-01T00:00:00", "2016-04-01T00:00:00", "2016-03-01T00:00:00", "2016-02-01T00:00:00", "2016-01-01T00:00:00", "2015-12-01T00:00:00", "2015-11-01T00:00:00", "2015-10-01T00:00:00", "2015-09-01T00:00:00", "2015-08-01T00:00:00", "2015-07-01T00:00:00", "2015-06-01T00:00:00", "2015-05-01T00:00:00", "2015-04-01T00:00:00", "2015-03-01T00:00:00", "2015-02-01T00:00:00", "2015-01-01T00:00:00", "2014-12-01T00:00:00", "2014-11-01T00:00:00", "2014-10-01T00:00:00", "2014-09-01T00:00:00", "2014-08-01T00:00:00", "2014-07-01T00:00:00", "2014-06-01T00:00:00", "2014-05-01T00:00:00", "2014-04-01T00:00:00", "2014-03-01T00:00:00", "2014-02-01T00:00:00", "2014-01-01T00:00:00", "2013-12-01T00:00:00", "2013-11-01T00:00:00", "2013-10-01T00:00:00", "2013-09-01T00:00:00", "2013-08-01T00:00:00", "2013-07-01T00:00:00", "2013-06-01T00:00:00", "2013-05-01T00:00:00", "2013-04-01T00:00:00", "2013-03-01T00:00:00", "2013-02-01T00:00:00", "2013-01-01T00:00:00", "2012-12-01T00:00:00", "2012-11-01T00:00:00", "2012-10-01T00:00:00", "2012-09-01T00:00:00", "2012-08-01T00:00:00", "2012-07-01T00:00:00", "2012-06-01T00:00:00", "2012-05-01T00:00:00", "2012-04-01T00:00:00", "2012-03-01T00:00:00", "2012-02-01T00:00:00", "2012-01-01T00:00:00", "2011-12-01T00:00:00", "2011-11-01T00:00:00", "2011-10-01T00:00:00", "2011-09-01T00:00:00", "2011-08-01T00:00:00", "2011-07-01T00:00:00", "2011-06-01T00:00:00", "2011-05-01T00:00:00", "2011-04-01T00:00:00", "2011-03-01T00:00:00", "2011-02-01T00:00:00", "2011-01-01T00:00:00", "2010-12-01T00:00:00", "2010-11-01T00:00:00", "2010-10-01T00:00:00", "2010-09-01T00:00:00", "2010-08-01T00:00:00", "2010-07-01T00:00:00" ], "xaxis": "x3", "y": [ 182.52, 184.4, 192.53, 189.95, 170.77, 171.21, 187.87, 196.45, 193.97, 177.25, 169.68, 164.9, 147.41, 144.29, 129.93, 148.03, 153.34, 138.2, 157.22, 162.51, 136.72, 148.84, 157.65, 174.61, 165.12, 174.78, 177.57, 165.3, 149.8, 141.5, 151.83, 145.86, 136.96, 124.61, 131.46, 122.15, 121.26, 131.96, 132.69, 119.05, 108.86, 115.81, 129.04, 106.26, 91.2, 79.49, 73.45, 63.57, 68.34, 77.38, 73.41, 66.81, 62.19, 55.99, 52.19, 53.26, 49.48, 43.77, 50.17, 47.49, 43.29, 41.61, 39.44, 44.65, 54.72, 56.44, 56.91, 47.57, 46.28, 46.72, 41.31, 41.94, 44.53, 41.86, 42.31, 42.96, 42.26, 38.53, 41, 37.18, 36.01, 38.19, 35.91, 35.92, 34.25, 30.34, 28.95, 27.63, 28.39, 28.26, 26.52, 26.05, 23.9, 24.97, 23.43, 27.25, 24.17, 24.33, 26.32, 29.58, 29.88, 27.58, 28.19, 30.33, 31.36, 32.57, 31.29, 31.11, 32.12, 29.29, 27.59, 29.73, 27, 25.19, 25.63, 23.9, 23.23, 22.61, 21.07, 19.17, 18.79, 17.88, 20.04, 19.86, 18.67, 17.03, 17.4, 16.16, 14.16, 16.06, 15.81, 15.81, 15.76, 16.27, 19.01, 20.9, 21.26, 23.83, 23.76, 21.81, 20.86, 20.63, 20.86, 21.41, 19.37, 16.3, 14.46, 13.65, 14.46, 13.62, 13.74, 13.95, 11.99, 12.42, 12.5, 12.45, 12.61, 12.12, 11.52, 11.11, 10.75, 10.13, 8.68, 9.19 ], "yaxis": "y3" }, { "hovertemplate": "company=Price_y
Date=%{x}
value=%{y}", "legendgroup": "Price_y", "line": { "color": "#EF553B", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Price_y", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2024-02-01T00:00:00", "2024-01-01T00:00:00", "2023-12-01T00:00:00", "2023-11-01T00:00:00", "2023-10-01T00:00:00", "2023-09-01T00:00:00", "2023-08-01T00:00:00", "2023-07-01T00:00:00", "2023-06-01T00:00:00", "2023-05-01T00:00:00", "2023-04-01T00:00:00", "2023-03-01T00:00:00", "2023-02-01T00:00:00", "2023-01-01T00:00:00", "2022-12-01T00:00:00", "2022-11-01T00:00:00", "2022-10-01T00:00:00", "2022-09-01T00:00:00", "2022-08-01T00:00:00", "2022-07-01T00:00:00", "2022-06-01T00:00:00", "2022-05-01T00:00:00", "2022-04-01T00:00:00", "2022-03-01T00:00:00", "2022-02-01T00:00:00", "2022-01-01T00:00:00", "2021-12-01T00:00:00", "2021-11-01T00:00:00", "2021-10-01T00:00:00", "2021-09-01T00:00:00", "2021-08-01T00:00:00", "2021-07-01T00:00:00", "2021-06-01T00:00:00", "2021-05-01T00:00:00", "2021-04-01T00:00:00", "2021-03-01T00:00:00", "2021-02-01T00:00:00", "2021-01-01T00:00:00", "2020-12-01T00:00:00", "2020-11-01T00:00:00", "2020-10-01T00:00:00", "2020-09-01T00:00:00", "2020-08-01T00:00:00", "2020-07-01T00:00:00", "2020-06-01T00:00:00", "2020-05-01T00:00:00", "2020-04-01T00:00:00", "2020-03-01T00:00:00", "2020-02-01T00:00:00", "2020-01-01T00:00:00", "2019-12-01T00:00:00", "2019-11-01T00:00:00", "2019-10-01T00:00:00", "2019-09-01T00:00:00", "2019-08-01T00:00:00", "2019-07-01T00:00:00", "2019-06-01T00:00:00", "2019-05-01T00:00:00", "2019-04-01T00:00:00", "2019-03-01T00:00:00", "2019-02-01T00:00:00", "2019-01-01T00:00:00", "2018-12-01T00:00:00", "2018-11-01T00:00:00", "2018-10-01T00:00:00", "2018-09-01T00:00:00", "2018-08-01T00:00:00", "2018-07-01T00:00:00", "2018-06-01T00:00:00", "2018-05-01T00:00:00", "2018-04-01T00:00:00", "2018-03-01T00:00:00", "2018-02-01T00:00:00", "2018-01-01T00:00:00", "2017-12-01T00:00:00", "2017-11-01T00:00:00", "2017-10-01T00:00:00", "2017-09-01T00:00:00", "2017-08-01T00:00:00", "2017-07-01T00:00:00", "2017-06-01T00:00:00", "2017-05-01T00:00:00", "2017-04-01T00:00:00", "2017-03-01T00:00:00", "2017-02-01T00:00:00", "2017-01-01T00:00:00", "2016-12-01T00:00:00", "2016-11-01T00:00:00", "2016-10-01T00:00:00", "2016-09-01T00:00:00", "2016-08-01T00:00:00", "2016-07-01T00:00:00", "2016-06-01T00:00:00", "2016-05-01T00:00:00", "2016-04-01T00:00:00", "2016-03-01T00:00:00", "2016-02-01T00:00:00", "2016-01-01T00:00:00", "2015-12-01T00:00:00", "2015-11-01T00:00:00", "2015-10-01T00:00:00", "2015-09-01T00:00:00", "2015-08-01T00:00:00", "2015-07-01T00:00:00", "2015-06-01T00:00:00", "2015-05-01T00:00:00", "2015-04-01T00:00:00", "2015-03-01T00:00:00", "2015-02-01T00:00:00", "2015-01-01T00:00:00", "2014-12-01T00:00:00", "2014-11-01T00:00:00", "2014-10-01T00:00:00", "2014-09-01T00:00:00", "2014-08-01T00:00:00", "2014-07-01T00:00:00", "2014-06-01T00:00:00", "2014-05-01T00:00:00", "2014-04-01T00:00:00", "2014-03-01T00:00:00", "2014-02-01T00:00:00", "2014-01-01T00:00:00", "2013-12-01T00:00:00", "2013-11-01T00:00:00", "2013-10-01T00:00:00", "2013-09-01T00:00:00", "2013-08-01T00:00:00", "2013-07-01T00:00:00", "2013-06-01T00:00:00", "2013-05-01T00:00:00", "2013-04-01T00:00:00", "2013-03-01T00:00:00", "2013-02-01T00:00:00", "2013-01-01T00:00:00", "2012-12-01T00:00:00", "2012-11-01T00:00:00", "2012-10-01T00:00:00", "2012-09-01T00:00:00", "2012-08-01T00:00:00", "2012-07-01T00:00:00", "2012-06-01T00:00:00", "2012-05-01T00:00:00", "2012-04-01T00:00:00", "2012-03-01T00:00:00", "2012-02-01T00:00:00", "2012-01-01T00:00:00", "2011-12-01T00:00:00", "2011-11-01T00:00:00", "2011-10-01T00:00:00", "2011-09-01T00:00:00", "2011-08-01T00:00:00", "2011-07-01T00:00:00", "2011-06-01T00:00:00", "2011-05-01T00:00:00", "2011-04-01T00:00:00", "2011-03-01T00:00:00", "2011-02-01T00:00:00", "2011-01-01T00:00:00", "2010-12-01T00:00:00", "2010-11-01T00:00:00", "2010-10-01T00:00:00", "2010-09-01T00:00:00", "2010-08-01T00:00:00", "2010-07-01T00:00:00" ], "xaxis": "x2", "y": [ 175.56, 165.25, 157.65, 155.69, 163.41, 159.93, 162.61, 159.86, 157.18, 146.87, 150.97, 147.45, 142.13, 143.87, 141.79, 152.42, 142.33, 129.7, 132.55, 132.05, 121.58, 128.63, 152.99, 148.92, 135.16, 139.81, 144.69, 140.63, 149.42, 139.38, 148.1, 142.55, 141.02, 142.03, 139.91, 135.83, 129.92, 140.49, 144.15, 152.79, 138.75, 139.91, 138.85, 129.4, 119.78, 124.06, 121.55, 113.62, 107.68, 114.49, 118.84, 119.09, 117.26, 118.68, 114.26, 110.38, 110.49, 101.44, 102.84, 97.53, 98.99, 95.83, 93.15, 97.65, 100.28, 93.91, 95.86, 89.23, 85.65, 82.54, 88.46, 88.97, 90.01, 106.6, 98.75, 97.23, 87.31, 78.14, 78.07, 79.99, 75.68, 78.6, 75.18, 72.08, 70.93, 66.74, 69.12, 70.43, 70.02, 72.12, 71.44, 72.97, 73.02, 70.78, 66.87, 68.49, 66.34, 66.36, 61.3, 58.84, 57.24, 64.84, 64.73, 71.98, 70.93, 74.27, 78.05, 82.25, 83.93, 84.98, 85.88, 87.54, 76.27, 76.47, 75.5, 73.58, 75.07, 76.77, 79.71, 76.43, 74.7, 74.68, 78.69, 81.01, 76.75, 73.96, 72.98, 77.94, 74.49, 74.84, 77.72, 74.83, 70.78, 69.95, 68.23, 72.02, 75.02, 73.8, 72.6, 74.43, 69.72, 65.82, 58.91, 61.2, 59.08, 61.36, 59.76, 58.9, 56.72, 51.9, 53.19, 52.71, 53.14, 55.22, 54.98, 52.05, 51.98, 56.07, 53.93, 54.09, 54.17, 53.52, 50.14, 51.19 ], "yaxis": "y2" }, { "hovertemplate": "company=Price
Date=%{x}
value=%{y}", "legendgroup": "Price", "line": { "color": "#00cc96", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "Price", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2024-02-01T00:00:00", "2024-01-01T00:00:00", "2023-12-01T00:00:00", "2023-11-01T00:00:00", "2023-10-01T00:00:00", "2023-09-01T00:00:00", "2023-08-01T00:00:00", "2023-07-01T00:00:00", "2023-06-01T00:00:00", "2023-05-01T00:00:00", "2023-04-01T00:00:00", "2023-03-01T00:00:00", "2023-02-01T00:00:00", "2023-01-01T00:00:00", "2022-12-01T00:00:00", "2022-11-01T00:00:00", "2022-10-01T00:00:00", "2022-09-01T00:00:00", "2022-08-01T00:00:00", "2022-07-01T00:00:00", "2022-06-01T00:00:00", "2022-05-01T00:00:00", "2022-04-01T00:00:00", "2022-03-01T00:00:00", "2022-02-01T00:00:00", "2022-01-01T00:00:00", "2021-12-01T00:00:00", "2021-11-01T00:00:00", "2021-10-01T00:00:00", "2021-09-01T00:00:00", "2021-08-01T00:00:00", "2021-07-01T00:00:00", "2021-06-01T00:00:00", "2021-05-01T00:00:00", "2021-04-01T00:00:00", "2021-03-01T00:00:00", "2021-02-01T00:00:00", "2021-01-01T00:00:00", "2020-12-01T00:00:00", "2020-11-01T00:00:00", "2020-10-01T00:00:00", "2020-09-01T00:00:00", "2020-08-01T00:00:00", "2020-07-01T00:00:00", "2020-06-01T00:00:00", "2020-05-01T00:00:00", "2020-04-01T00:00:00", "2020-03-01T00:00:00", "2020-02-01T00:00:00", "2020-01-01T00:00:00", "2019-12-01T00:00:00", "2019-11-01T00:00:00", "2019-10-01T00:00:00", "2019-09-01T00:00:00", "2019-08-01T00:00:00", "2019-07-01T00:00:00", "2019-06-01T00:00:00", "2019-05-01T00:00:00", "2019-04-01T00:00:00", "2019-03-01T00:00:00", "2019-02-01T00:00:00", "2019-01-01T00:00:00", "2018-12-01T00:00:00", "2018-11-01T00:00:00", "2018-10-01T00:00:00", "2018-09-01T00:00:00", "2018-08-01T00:00:00", "2018-07-01T00:00:00", "2018-06-01T00:00:00", "2018-05-01T00:00:00", "2018-04-01T00:00:00", "2018-03-01T00:00:00", "2018-02-01T00:00:00", "2018-01-01T00:00:00", "2017-12-01T00:00:00", "2017-11-01T00:00:00", "2017-10-01T00:00:00", "2017-09-01T00:00:00", "2017-08-01T00:00:00", "2017-07-01T00:00:00", "2017-06-01T00:00:00", "2017-05-01T00:00:00", "2017-04-01T00:00:00", "2017-03-01T00:00:00", "2017-02-01T00:00:00", "2017-01-01T00:00:00", "2016-12-01T00:00:00", "2016-11-01T00:00:00", "2016-10-01T00:00:00", "2016-09-01T00:00:00", "2016-08-01T00:00:00", "2016-07-01T00:00:00", "2016-06-01T00:00:00", "2016-05-01T00:00:00", "2016-04-01T00:00:00", "2016-03-01T00:00:00", "2016-02-01T00:00:00", "2016-01-01T00:00:00", "2015-12-01T00:00:00", "2015-11-01T00:00:00", "2015-10-01T00:00:00", "2015-09-01T00:00:00", "2015-08-01T00:00:00", "2015-07-01T00:00:00", "2015-06-01T00:00:00", "2015-05-01T00:00:00", "2015-04-01T00:00:00", "2015-03-01T00:00:00", "2015-02-01T00:00:00", "2015-01-01T00:00:00", "2014-12-01T00:00:00", "2014-11-01T00:00:00", "2014-10-01T00:00:00", "2014-09-01T00:00:00", "2014-08-01T00:00:00", "2014-07-01T00:00:00", "2014-06-01T00:00:00", "2014-05-01T00:00:00", "2014-04-01T00:00:00", "2014-03-01T00:00:00", "2014-02-01T00:00:00", "2014-01-01T00:00:00", "2013-12-01T00:00:00", "2013-11-01T00:00:00", "2013-10-01T00:00:00", "2013-09-01T00:00:00", "2013-08-01T00:00:00", "2013-07-01T00:00:00", "2013-06-01T00:00:00", "2013-05-01T00:00:00", "2013-04-01T00:00:00", "2013-03-01T00:00:00", "2013-02-01T00:00:00", "2013-01-01T00:00:00", "2012-12-01T00:00:00", "2012-11-01T00:00:00", "2012-10-01T00:00:00", "2012-09-01T00:00:00", "2012-08-01T00:00:00", "2012-07-01T00:00:00", "2012-06-01T00:00:00", "2012-05-01T00:00:00", "2012-04-01T00:00:00", "2012-03-01T00:00:00", "2012-02-01T00:00:00", "2012-01-01T00:00:00", "2011-12-01T00:00:00", "2011-11-01T00:00:00", "2011-10-01T00:00:00", "2011-09-01T00:00:00", "2011-08-01T00:00:00", "2011-07-01T00:00:00", "2011-06-01T00:00:00", "2011-05-01T00:00:00", "2011-04-01T00:00:00", "2011-03-01T00:00:00", "2011-02-01T00:00:00", "2011-01-01T00:00:00", "2010-12-01T00:00:00", "2010-11-01T00:00:00", "2010-10-01T00:00:00", "2010-09-01T00:00:00", "2010-08-01T00:00:00", "2010-07-01T00:00:00" ], "xaxis": "x", "y": [ 191.97, 187.29, 248.48, 240.08, 200.84, 250.22, 258.08, 267.43, 261.77, 203.93, 164.31, 207.46, 205.71, 173.22, 123.18, 194.7, 227.54, 265.25, 275.61, 297.15, 224.47, 252.75, 290.25, 359.2, 290.14, 312.24, 352.26, 381.59, 371.33, 258.49, 245.24, 229.07, 226.57, 208.41, 236.48, 222.64, 225.17, 264.51, 235.22, 189.2, 129.35, 143, 166.11, 95.38, 71.99, 55.67, 52.13, 34.93, 44.53, 43.37, 27.89, 22, 20.99, 16.06, 15.04, 16.11, 14.9, 12.34, 15.91, 18.66, 21.33, 20.47, 22.19, 23.37, 22.49, 17.65, 20.11, 19.88, 22.86, 18.98, 19.59, 17.74, 22.87, 23.62, 20.76, 20.59, 22.1, 22.74, 23.73, 21.56, 24.11, 22.73, 20.94, 18.55, 16.67, 16.8, 14.25, 12.63, 13.18, 13.6, 14.13, 15.65, 14.15, 14.88, 16.05, 15.32, 12.8, 12.75, 16, 15.35, 13.8, 16.56, 16.6, 17.74, 17.88, 16.72, 15.07, 12.58, 13.56, 13.57, 14.83, 16.3, 16.11, 16.18, 17.98, 14.89, 16, 13.85, 13.86, 13.9, 16.32, 12.09, 10.03, 8.49, 10.66, 12.89, 11.27, 8.95, 7.16, 6.52, 3.6, 2.53, 2.32, 2.5, 2.26, 2.25, 1.88, 1.95, 1.9, 1.83, 2.09, 1.97, 2.21, 2.48, 2.23, 1.94, 1.9, 2.18, 1.96, 1.63, 1.65, 1.88, 1.94, 2.01, 1.84, 1.85, 1.59, 1.61, 1.78, 2.36, 1.46, 1.36, 1.3, 1.33 ], "yaxis": "y" } ], "layout": { "annotations": [ { "font": {}, "showarrow": false, "text": "company=Price", "x": 0.5, "xanchor": "center", "xref": "paper", "y": 0.2866666666666666, "yanchor": "bottom", "yref": "paper" }, { "font": {}, "showarrow": false, "text": "company=Price_y", "x": 0.5, "xanchor": "center", "xref": "paper", "y": 0.6433333333333333, "yanchor": "bottom", "yref": "paper" }, { "font": {}, "showarrow": false, "text": "company=Price_x", "x": 0.5, "xanchor": "center", "xref": "paper", "y": 0.9999999999999999, "yanchor": "bottom", "yref": "paper" } ], "legend": { "title": { "text": "company" }, "tracegroupgap": 0 }, "margin": { "t": 60 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "Date" } }, "xaxis2": { "anchor": "y2", "domain": [ 0, 1 ], "matches": "x", "showticklabels": false }, "xaxis3": { "anchor": "y3", "domain": [ 0, 1 ], "matches": "x", "showticklabels": false }, "yaxis": { "anchor": "x", "domain": [ 0, 0.2866666666666666 ], "title": { "text": "value" } }, "yaxis2": { "anchor": "x2", "domain": [ 0.35666666666666663, 0.6433333333333333 ], "title": { "text": "value" } }, "yaxis3": { "anchor": "x3", "domain": [ 0.7133333333333333, 0.9999999999999999 ], "title": { "text": "value" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = px.line(df, facet_col=\"company\", facet_col_wrap=1)\n", "fig.update_yaxes(matches=None)\n", "fig.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "py311-kfp240-airflow251", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.1" } }, "nbformat": 4, "nbformat_minor": 2 }