transform testing
This commit is contained in:
parent
66ad448516
commit
9a71cdf355
448
testing.ipynb
448
testing.ipynb
@ -478,7 +478,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": 1,
|
||||||
"id": "aead3e77-2670-4541-846a-5537b01f3d2e",
|
"id": "aead3e77-2670-4541-846a-5537b01f3d2e",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
@ -493,7 +493,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": 2,
|
||||||
"id": "f287e05f",
|
"id": "f287e05f",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
@ -583,34 +583,34 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 4,
|
"execution_count": 12,
|
||||||
"id": "c85b5dd9-9a88-4608-ac58-1a141295f63f",
|
"id": "c85b5dd9-9a88-4608-ac58-1a141295f63f",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"data = sample_data_generator(num=261, frequency=fc.AllFrequencies.W, mu=0.6, sigma=0.7)\n",
|
"data = sample_data_generator(num=261, frequency=fc.AllFrequencies.W)\n",
|
||||||
"ts = fc.TimeSeries(data, \"W\")"
|
"ts = fc.TimeSeries(data, \"W\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 5,
|
"execution_count": 13,
|
||||||
"id": "0488a4d0-bca1-4341-9fae-1fd254adc0dc",
|
"id": "0488a4d0-bca1-4341-9fae-1fd254adc0dc",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"TimeSeries([(datetime.datetime(2017, 1, 1, 0, 0), 1040.39),\n",
|
"TimeSeries([(datetime.datetime(2017, 1, 1, 0, 0), 1003.03),\n",
|
||||||
"\t (datetime.datetime(2017, 1, 8, 0, 0), 1032.83),\n",
|
"\t (datetime.datetime(2017, 1, 8, 0, 0), 1002.71),\n",
|
||||||
"\t (datetime.datetime(2017, 1, 15, 0, 0), 1120.5)\n",
|
"\t (datetime.datetime(2017, 1, 15, 0, 0), 1008.77)\n",
|
||||||
"\t ...\n",
|
"\t ...\n",
|
||||||
"\t (datetime.datetime(2021, 12, 12, 0, 0), 2007.18),\n",
|
"\t (datetime.datetime(2021, 12, 12, 0, 0), 1107.21),\n",
|
||||||
"\t (datetime.datetime(2021, 12, 19, 0, 0), 1987.49),\n",
|
"\t (datetime.datetime(2021, 12, 19, 0, 0), 1106.66),\n",
|
||||||
"\t (datetime.datetime(2021, 12, 26, 0, 0), 1924.2)], frequency='W')"
|
"\t (datetime.datetime(2021, 12, 26, 0, 0), 1104.32)], frequency='W')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 5,
|
"execution_count": 13,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@ -621,429 +621,71 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 6,
|
"execution_count": 14,
|
||||||
"id": "cd0eb38c",
|
"id": "04624145-4fce-484c-aa69-0d17d159b598",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"dates = fc.create_date_series(ts.start_date, ts.end_date, 'M')"
|
"tst = ts.transform('Q', 'mean', False)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 7,
|
"execution_count": 16,
|
||||||
"id": "69c48512",
|
"id": "75ed1666-5fc8-4707-bf42-62d44adcae18",
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"prev_date = dates[0]\n",
|
|
||||||
"for i in dates[1:]:\n",
|
|
||||||
" cur_date = i\n",
|
|
||||||
" "
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 8,
|
|
||||||
"id": "43fa2254",
|
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"TimeSeries([(datetime.datetime(2017, 1, 8, 0, 0), 1032.83),\n",
|
"20"
|
||||||
"\t(datetime.datetime(2017, 1, 15, 0, 0), 1120.5),\n",
|
|
||||||
"\t(datetime.datetime(2017, 1, 22, 0, 0), 1125.86),\n",
|
|
||||||
"\t(datetime.datetime(2017, 1, 29, 0, 0), 1178.74)], frequency='W')"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 8,
|
"execution_count": 16,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"ts[(ts.dates < '2017-01-31') & (ts.dates > '2017-01-01')]"
|
"len(tst)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 9,
|
"execution_count": 15,
|
||||||
"id": "32a82399-e056-45d6-86a3-b9f0855aed27",
|
"id": "bccd7d1c-2d57-444c-af68-290f476f2b05",
|
||||||
"metadata": {},
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"data": {
|
|
||||||
"text/plain": [
|
|
||||||
"Series([datetime.datetime(2017, 1, 1, 0, 0), datetime.datetime(2017, 2, 1, 0, 0), datetime.datetime(2017, 3, 1, 0, 0), datetime.datetime(2017, 4, 1, 0, 0), datetime.datetime(2017, 5, 1, 0, 0), datetime.datetime(2017, 6, 1, 0, 0), datetime.datetime(2017, 7, 1, 0, 0), datetime.datetime(2017, 8, 1, 0, 0), datetime.datetime(2017, 9, 1, 0, 0), datetime.datetime(2017, 10, 1, 0, 0), datetime.datetime(2017, 11, 1, 0, 0), datetime.datetime(2017, 12, 1, 0, 0), datetime.datetime(2018, 1, 1, 0, 0), datetime.datetime(2018, 2, 1, 0, 0), datetime.datetime(2018, 3, 1, 0, 0), datetime.datetime(2018, 4, 1, 0, 0), datetime.datetime(2018, 5, 1, 0, 0), datetime.datetime(2018, 6, 1, 0, 0), datetime.datetime(2018, 7, 1, 0, 0), datetime.datetime(2018, 8, 1, 0, 0), datetime.datetime(2018, 9, 1, 0, 0), datetime.datetime(2018, 10, 1, 0, 0), datetime.datetime(2018, 11, 1, 0, 0), datetime.datetime(2018, 12, 1, 0, 0), datetime.datetime(2019, 1, 1, 0, 0), datetime.datetime(2019, 2, 1, 0, 0), datetime.datetime(2019, 3, 1, 0, 0), datetime.datetime(2019, 4, 1, 0, 0), datetime.datetime(2019, 5, 1, 0, 0), datetime.datetime(2019, 6, 1, 0, 0), datetime.datetime(2019, 7, 1, 0, 0), datetime.datetime(2019, 8, 1, 0, 0), datetime.datetime(2019, 9, 1, 0, 0), datetime.datetime(2019, 10, 1, 0, 0), datetime.datetime(2019, 11, 1, 0, 0), datetime.datetime(2019, 12, 1, 0, 0), datetime.datetime(2020, 1, 1, 0, 0), datetime.datetime(2020, 2, 1, 0, 0), datetime.datetime(2020, 3, 1, 0, 0), datetime.datetime(2020, 4, 1, 0, 0), datetime.datetime(2020, 5, 1, 0, 0), datetime.datetime(2020, 6, 1, 0, 0), datetime.datetime(2020, 7, 1, 0, 0), datetime.datetime(2020, 8, 1, 0, 0), datetime.datetime(2020, 9, 1, 0, 0), datetime.datetime(2020, 10, 1, 0, 0), datetime.datetime(2020, 11, 1, 0, 0), datetime.datetime(2020, 12, 1, 0, 0), datetime.datetime(2021, 1, 1, 0, 0), datetime.datetime(2021, 2, 1, 0, 0), datetime.datetime(2021, 3, 1, 0, 0), datetime.datetime(2021, 4, 1, 0, 0), datetime.datetime(2021, 5, 1, 0, 0), datetime.datetime(2021, 6, 1, 0, 0), datetime.datetime(2021, 7, 1, 0, 0), datetime.datetime(2021, 8, 1, 0, 0), datetime.datetime(2021, 9, 1, 0, 0), datetime.datetime(2021, 10, 1, 0, 0), datetime.datetime(2021, 11, 1, 0, 0), datetime.datetime(2021, 12, 1, 0, 0)], data_type='datetime')"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"execution_count": 9,
|
|
||||||
"metadata": {},
|
|
||||||
"output_type": "execute_result"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
|
||||||
"dates"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 13,
|
|
||||||
"id": "352a71a3-5469-4464-8a93-17f4660822fd",
|
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"2017-01-01 00:00:00 1040.39\n",
|
"(datetime.datetime(2017, 1, 1, 0, 0), 1010.4553846153846)\n",
|
||||||
"2017-01-08 00:00:00 1032.83\n",
|
"(datetime.datetime(2017, 4, 1, 0, 0), 1019.34)\n",
|
||||||
"2017-01-15 00:00:00 1120.5\n",
|
"(datetime.datetime(2017, 7, 1, 0, 0), 1015.3515384615384)\n",
|
||||||
"2017-01-22 00:00:00 1125.86\n",
|
"(datetime.datetime(2017, 10, 1, 0, 0), 1031.2892857142858)\n",
|
||||||
"2017-01-29 00:00:00 1178.74\n",
|
"(datetime.datetime(2018, 1, 1, 0, 0), 1054.7216666666666)\n",
|
||||||
"2017-02-05 00:00:00 1158.8\n",
|
"(datetime.datetime(2018, 4, 1, 0, 0), 1059.736153846154)\n",
|
||||||
"2017-02-12 00:00:00 1151.54\n",
|
"(datetime.datetime(2018, 7, 1, 0, 0), 1049.1100000000001)\n",
|
||||||
"2017-02-19 00:00:00 1137.19\n",
|
"(datetime.datetime(2018, 10, 1, 0, 0), 1051.663076923077)\n",
|
||||||
"2017-02-26 00:00:00 1141.47\n",
|
"(datetime.datetime(2019, 1, 1, 0, 0), 1062.2869230769231)\n",
|
||||||
"2017-03-05 00:00:00 1112.37\n",
|
"(datetime.datetime(2019, 4, 1, 0, 0), 1059.7423076923076)\n",
|
||||||
"2017-03-12 00:00:00 1186.34\n",
|
"(datetime.datetime(2019, 7, 1, 0, 0), 1050.7661538461539)\n",
|
||||||
"2017-03-19 00:00:00 1202.35\n",
|
"(datetime.datetime(2019, 10, 1, 0, 0), 1045.2061538461537)\n",
|
||||||
"2017-03-26 00:00:00 1169.04\n",
|
"(datetime.datetime(2020, 1, 1, 0, 0), 1046.11)\n",
|
||||||
"2017-04-02 00:00:00 1220.55\n",
|
"(datetime.datetime(2020, 4, 1, 0, 0), 1053.126923076923)\n",
|
||||||
"2017-04-09 00:00:00 1202.93\n",
|
"(datetime.datetime(2020, 7, 1, 0, 0), 1053.273846153846)\n",
|
||||||
"2017-04-16 00:00:00 1187.57\n",
|
"(datetime.datetime(2020, 10, 1, 0, 0), 1064.2384615384615)\n",
|
||||||
"2017-04-23 00:00:00 1197.52\n",
|
"(datetime.datetime(2021, 1, 1, 0, 0), 1073.1538461538462)\n",
|
||||||
"2017-04-30 00:00:00 1218.61\n",
|
"(datetime.datetime(2021, 4, 1, 0, 0), 1094.3215384615385)\n",
|
||||||
"2017-05-07 00:00:00 1272.3\n",
|
"(datetime.datetime(2021, 7, 1, 0, 0), 1104.3584615384616)\n",
|
||||||
"2017-05-14 00:00:00 1278.49\n",
|
"(datetime.datetime(2021, 10, 1, 0, 0), 1112.806923076923)\n"
|
||||||
"2017-05-21 00:00:00 1296.56\n",
|
|
||||||
"2017-05-28 00:00:00 1294.03\n",
|
|
||||||
"2017-06-04 00:00:00 1244.9\n",
|
|
||||||
"2017-06-11 00:00:00 1233.13\n",
|
|
||||||
"2017-06-18 00:00:00 1218.74\n",
|
|
||||||
"2017-06-25 00:00:00 1208.5\n",
|
|
||||||
"2017-07-02 00:00:00 1179.17\n",
|
|
||||||
"2017-07-09 00:00:00 1164.11\n",
|
|
||||||
"2017-07-16 00:00:00 1109.05\n",
|
|
||||||
"2017-07-23 00:00:00 1090.0\n",
|
|
||||||
"2017-07-30 00:00:00 1054.5\n",
|
|
||||||
"2017-08-06 00:00:00 1059.84\n",
|
|
||||||
"2017-08-13 00:00:00 1061.35\n",
|
|
||||||
"2017-08-20 00:00:00 1157.0\n",
|
|
||||||
"2017-08-27 00:00:00 1109.25\n",
|
|
||||||
"2017-09-03 00:00:00 1124.86\n",
|
|
||||||
"2017-09-10 00:00:00 1175.81\n",
|
|
||||||
"2017-09-17 00:00:00 1183.18\n",
|
|
||||||
"2017-09-24 00:00:00 1208.74\n",
|
|
||||||
"2017-10-01 00:00:00 1210.82\n",
|
|
||||||
"2017-10-08 00:00:00 1170.14\n",
|
|
||||||
"2017-10-15 00:00:00 1178.4\n",
|
|
||||||
"2017-10-22 00:00:00 1235.02\n",
|
|
||||||
"2017-10-29 00:00:00 1256.52\n",
|
|
||||||
"2017-11-05 00:00:00 1288.37\n",
|
|
||||||
"2017-11-12 00:00:00 1342.41\n",
|
|
||||||
"2017-11-19 00:00:00 1417.1\n",
|
|
||||||
"2017-11-26 00:00:00 1518.11\n",
|
|
||||||
"2017-12-03 00:00:00 1538.06\n",
|
|
||||||
"2017-12-10 00:00:00 1405.51\n",
|
|
||||||
"2017-12-17 00:00:00 1434.94\n",
|
|
||||||
"2017-12-24 00:00:00 1471.6\n",
|
|
||||||
"2017-12-31 00:00:00 1515.75\n",
|
|
||||||
"2018-01-07 00:00:00 1528.28\n",
|
|
||||||
"2018-01-14 00:00:00 1541.99\n",
|
|
||||||
"2018-01-21 00:00:00 1510.71\n",
|
|
||||||
"2018-01-28 00:00:00 1592.01\n",
|
|
||||||
"2018-02-04 00:00:00 1718.11\n",
|
|
||||||
"2018-02-11 00:00:00 1788.51\n",
|
|
||||||
"2018-02-18 00:00:00 1895.84\n",
|
|
||||||
"2018-02-25 00:00:00 1965.28\n",
|
|
||||||
"2018-03-04 00:00:00 1985.45\n",
|
|
||||||
"2018-03-11 00:00:00 1948.76\n",
|
|
||||||
"2018-03-18 00:00:00 2004.36\n",
|
|
||||||
"2018-03-25 00:00:00 2040.49\n",
|
|
||||||
"2018-04-01 00:00:00 1966.17\n",
|
|
||||||
"2018-04-08 00:00:00 1984.85\n",
|
|
||||||
"2018-04-15 00:00:00 1908.0\n",
|
|
||||||
"2018-04-22 00:00:00 1970.14\n",
|
|
||||||
"2018-04-29 00:00:00 1840.56\n",
|
|
||||||
"2018-05-06 00:00:00 1736.25\n",
|
|
||||||
"2018-05-13 00:00:00 1779.54\n",
|
|
||||||
"2018-05-20 00:00:00 1803.03\n",
|
|
||||||
"2018-05-27 00:00:00 1754.64\n",
|
|
||||||
"2018-06-03 00:00:00 1785.96\n",
|
|
||||||
"2018-06-10 00:00:00 1817.42\n",
|
|
||||||
"2018-06-17 00:00:00 1788.5\n",
|
|
||||||
"2018-06-24 00:00:00 1803.23\n",
|
|
||||||
"2018-07-01 00:00:00 1686.82\n",
|
|
||||||
"2018-07-08 00:00:00 1666.94\n",
|
|
||||||
"2018-07-15 00:00:00 1559.94\n",
|
|
||||||
"2018-07-22 00:00:00 1571.29\n",
|
|
||||||
"2018-07-29 00:00:00 1527.71\n",
|
|
||||||
"2018-08-05 00:00:00 1463.91\n",
|
|
||||||
"2018-08-12 00:00:00 1418.93\n",
|
|
||||||
"2018-08-19 00:00:00 1488.85\n",
|
|
||||||
"2018-08-26 00:00:00 1502.09\n",
|
|
||||||
"2018-09-02 00:00:00 1473.89\n",
|
|
||||||
"2018-09-09 00:00:00 1511.63\n",
|
|
||||||
"2018-09-16 00:00:00 1489.29\n",
|
|
||||||
"2018-09-23 00:00:00 1550.82\n",
|
|
||||||
"2018-09-30 00:00:00 1645.07\n",
|
|
||||||
"2018-10-07 00:00:00 1626.79\n",
|
|
||||||
"2018-10-14 00:00:00 1527.51\n",
|
|
||||||
"2018-10-21 00:00:00 1508.86\n",
|
|
||||||
"2018-10-28 00:00:00 1517.32\n",
|
|
||||||
"2018-11-04 00:00:00 1505.09\n",
|
|
||||||
"2018-11-11 00:00:00 1517.15\n",
|
|
||||||
"2018-11-18 00:00:00 1515.15\n",
|
|
||||||
"2018-11-25 00:00:00 1531.76\n",
|
|
||||||
"2018-12-02 00:00:00 1509.4\n",
|
|
||||||
"2018-12-09 00:00:00 1509.87\n",
|
|
||||||
"2018-12-16 00:00:00 1591.72\n",
|
|
||||||
"2018-12-23 00:00:00 1556.62\n",
|
|
||||||
"2018-12-30 00:00:00 1502.95\n",
|
|
||||||
"2019-01-06 00:00:00 1630.62\n",
|
|
||||||
"2019-01-13 00:00:00 1674.96\n",
|
|
||||||
"2019-01-20 00:00:00 1695.86\n",
|
|
||||||
"2019-01-27 00:00:00 1757.33\n",
|
|
||||||
"2019-02-03 00:00:00 1789.38\n",
|
|
||||||
"2019-02-10 00:00:00 1810.87\n",
|
|
||||||
"2019-02-17 00:00:00 1877.5\n",
|
|
||||||
"2019-02-24 00:00:00 1839.49\n",
|
|
||||||
"2019-03-03 00:00:00 1710.78\n",
|
|
||||||
"2019-03-10 00:00:00 1600.36\n",
|
|
||||||
"2019-03-17 00:00:00 1601.57\n",
|
|
||||||
"2019-03-24 00:00:00 1530.07\n",
|
|
||||||
"2019-03-31 00:00:00 1618.94\n",
|
|
||||||
"2019-04-07 00:00:00 1531.05\n",
|
|
||||||
"2019-04-14 00:00:00 1524.31\n",
|
|
||||||
"2019-04-21 00:00:00 1559.94\n",
|
|
||||||
"2019-04-28 00:00:00 1630.43\n",
|
|
||||||
"2019-05-05 00:00:00 1597.4\n",
|
|
||||||
"2019-05-12 00:00:00 1703.88\n",
|
|
||||||
"2019-05-19 00:00:00 1635.2\n",
|
|
||||||
"2019-05-26 00:00:00 1621.76\n",
|
|
||||||
"2019-06-02 00:00:00 1634.33\n",
|
|
||||||
"2019-06-09 00:00:00 1562.77\n",
|
|
||||||
"2019-06-16 00:00:00 1549.12\n",
|
|
||||||
"2019-06-23 00:00:00 1576.87\n",
|
|
||||||
"2019-06-30 00:00:00 1487.67\n",
|
|
||||||
"2019-07-07 00:00:00 1404.03\n",
|
|
||||||
"2019-07-14 00:00:00 1416.17\n",
|
|
||||||
"2019-07-21 00:00:00 1401.12\n",
|
|
||||||
"2019-07-28 00:00:00 1401.12\n",
|
|
||||||
"2019-08-04 00:00:00 1405.16\n",
|
|
||||||
"2019-08-11 00:00:00 1373.43\n",
|
|
||||||
"2019-08-18 00:00:00 1312.29\n",
|
|
||||||
"2019-08-25 00:00:00 1314.92\n",
|
|
||||||
"2019-09-01 00:00:00 1289.19\n",
|
|
||||||
"2019-09-08 00:00:00 1300.85\n",
|
|
||||||
"2019-09-15 00:00:00 1352.79\n",
|
|
||||||
"2019-09-22 00:00:00 1351.29\n",
|
|
||||||
"2019-09-29 00:00:00 1319.38\n",
|
|
||||||
"2019-10-06 00:00:00 1341.78\n",
|
|
||||||
"2019-10-13 00:00:00 1300.52\n",
|
|
||||||
"2019-10-20 00:00:00 1389.83\n",
|
|
||||||
"2019-10-27 00:00:00 1302.28\n",
|
|
||||||
"2019-11-03 00:00:00 1202.98\n",
|
|
||||||
"2019-11-10 00:00:00 1181.17\n",
|
|
||||||
"2019-11-17 00:00:00 1125.6\n",
|
|
||||||
"2019-11-24 00:00:00 1156.62\n",
|
|
||||||
"2019-12-01 00:00:00 1205.04\n",
|
|
||||||
"2019-12-08 00:00:00 1138.9\n",
|
|
||||||
"2019-12-15 00:00:00 1167.41\n",
|
|
||||||
"2019-12-22 00:00:00 1187.0\n",
|
|
||||||
"2019-12-29 00:00:00 1117.66\n",
|
|
||||||
"2020-01-05 00:00:00 1162.87\n",
|
|
||||||
"2020-01-12 00:00:00 1160.5\n",
|
|
||||||
"2020-01-19 00:00:00 1182.43\n",
|
|
||||||
"2020-01-26 00:00:00 1162.46\n",
|
|
||||||
"2020-02-02 00:00:00 1184.64\n",
|
|
||||||
"2020-02-09 00:00:00 1173.68\n",
|
|
||||||
"2020-02-16 00:00:00 1120.14\n",
|
|
||||||
"2020-02-23 00:00:00 1203.76\n",
|
|
||||||
"2020-03-01 00:00:00 1234.59\n",
|
|
||||||
"2020-03-08 00:00:00 1164.89\n",
|
|
||||||
"2020-03-15 00:00:00 1193.34\n",
|
|
||||||
"2020-03-22 00:00:00 1213.7\n",
|
|
||||||
"2020-03-29 00:00:00 1248.24\n",
|
|
||||||
"2020-04-05 00:00:00 1291.25\n",
|
|
||||||
"2020-04-12 00:00:00 1313.79\n",
|
|
||||||
"2020-04-19 00:00:00 1250.83\n",
|
|
||||||
"2020-04-26 00:00:00 1282.44\n",
|
|
||||||
"2020-05-03 00:00:00 1237.36\n",
|
|
||||||
"2020-05-10 00:00:00 1244.45\n",
|
|
||||||
"2020-05-17 00:00:00 1209.46\n",
|
|
||||||
"2020-05-24 00:00:00 1215.62\n",
|
|
||||||
"2020-05-31 00:00:00 1176.28\n",
|
|
||||||
"2020-06-07 00:00:00 1220.93\n",
|
|
||||||
"2020-06-14 00:00:00 1236.97\n",
|
|
||||||
"2020-06-21 00:00:00 1292.12\n",
|
|
||||||
"2020-06-28 00:00:00 1341.62\n",
|
|
||||||
"2020-07-05 00:00:00 1319.86\n",
|
|
||||||
"2020-07-12 00:00:00 1286.69\n",
|
|
||||||
"2020-07-19 00:00:00 1228.97\n",
|
|
||||||
"2020-07-26 00:00:00 1253.36\n",
|
|
||||||
"2020-08-02 00:00:00 1186.4\n",
|
|
||||||
"2020-08-09 00:00:00 1176.77\n",
|
|
||||||
"2020-08-16 00:00:00 1160.93\n",
|
|
||||||
"2020-08-23 00:00:00 1112.51\n",
|
|
||||||
"2020-08-30 00:00:00 1168.84\n",
|
|
||||||
"2020-09-06 00:00:00 1191.77\n",
|
|
||||||
"2020-09-13 00:00:00 1202.53\n",
|
|
||||||
"2020-09-20 00:00:00 1253.35\n",
|
|
||||||
"2020-09-27 00:00:00 1220.74\n",
|
|
||||||
"2020-10-04 00:00:00 1298.59\n",
|
|
||||||
"2020-10-11 00:00:00 1289.99\n",
|
|
||||||
"2020-10-18 00:00:00 1331.7\n",
|
|
||||||
"2020-10-25 00:00:00 1331.88\n",
|
|
||||||
"2020-11-01 00:00:00 1316.17\n",
|
|
||||||
"2020-11-08 00:00:00 1278.24\n",
|
|
||||||
"2020-11-15 00:00:00 1316.89\n",
|
|
||||||
"2020-11-22 00:00:00 1304.82\n",
|
|
||||||
"2020-11-29 00:00:00 1336.41\n",
|
|
||||||
"2020-12-06 00:00:00 1424.98\n",
|
|
||||||
"2020-12-13 00:00:00 1414.69\n",
|
|
||||||
"2020-12-20 00:00:00 1480.55\n",
|
|
||||||
"2020-12-27 00:00:00 1442.9\n",
|
|
||||||
"2021-01-03 00:00:00 1415.72\n",
|
|
||||||
"2021-01-10 00:00:00 1394.22\n",
|
|
||||||
"2021-01-17 00:00:00 1434.96\n",
|
|
||||||
"2021-01-24 00:00:00 1426.63\n",
|
|
||||||
"2021-01-31 00:00:00 1518.6\n",
|
|
||||||
"2021-02-07 00:00:00 1461.76\n",
|
|
||||||
"2021-02-14 00:00:00 1427.69\n",
|
|
||||||
"2021-02-21 00:00:00 1447.32\n",
|
|
||||||
"2021-02-28 00:00:00 1412.62\n",
|
|
||||||
"2021-03-07 00:00:00 1422.12\n",
|
|
||||||
"2021-03-14 00:00:00 1433.03\n",
|
|
||||||
"2021-03-21 00:00:00 1599.56\n",
|
|
||||||
"2021-03-28 00:00:00 1643.38\n",
|
|
||||||
"2021-04-04 00:00:00 1735.51\n",
|
|
||||||
"2021-04-11 00:00:00 1721.82\n",
|
|
||||||
"2021-04-18 00:00:00 1801.1\n",
|
|
||||||
"2021-04-25 00:00:00 1798.19\n",
|
|
||||||
"2021-05-02 00:00:00 1728.64\n",
|
|
||||||
"2021-05-09 00:00:00 1761.09\n",
|
|
||||||
"2021-05-16 00:00:00 1864.6\n",
|
|
||||||
"2021-05-23 00:00:00 1915.55\n",
|
|
||||||
"2021-05-30 00:00:00 1880.83\n",
|
|
||||||
"2021-06-06 00:00:00 1985.8\n",
|
|
||||||
"2021-06-13 00:00:00 2031.42\n",
|
|
||||||
"2021-06-20 00:00:00 2005.34\n",
|
|
||||||
"2021-06-27 00:00:00 1903.11\n",
|
|
||||||
"2021-07-04 00:00:00 1902.17\n",
|
|
||||||
"2021-07-11 00:00:00 1943.94\n",
|
|
||||||
"2021-07-18 00:00:00 1848.16\n",
|
|
||||||
"2021-07-25 00:00:00 1807.84\n",
|
|
||||||
"2021-08-01 00:00:00 1885.75\n",
|
|
||||||
"2021-08-08 00:00:00 1930.57\n",
|
|
||||||
"2021-08-15 00:00:00 2004.8\n",
|
|
||||||
"2021-08-22 00:00:00 2181.39\n",
|
|
||||||
"2021-08-29 00:00:00 2112.61\n",
|
|
||||||
"2021-09-05 00:00:00 2176.47\n",
|
|
||||||
"2021-09-12 00:00:00 2255.73\n",
|
|
||||||
"2021-09-19 00:00:00 2224.32\n",
|
|
||||||
"2021-09-26 00:00:00 2195.41\n",
|
|
||||||
"2021-10-03 00:00:00 2255.36\n",
|
|
||||||
"2021-10-10 00:00:00 2238.18\n",
|
|
||||||
"2021-10-17 00:00:00 2290.97\n",
|
|
||||||
"2021-10-24 00:00:00 2380.52\n",
|
|
||||||
"2021-10-31 00:00:00 2237.11\n",
|
|
||||||
"2021-11-07 00:00:00 2234.85\n",
|
|
||||||
"2021-11-14 00:00:00 2281.46\n",
|
|
||||||
"2021-11-21 00:00:00 2225.14\n",
|
|
||||||
"2021-11-28 00:00:00 2200.28\n",
|
|
||||||
"2021-12-05 00:00:00 2104.56\n",
|
|
||||||
"2021-12-12 00:00:00 2007.18\n",
|
|
||||||
"2021-12-19 00:00:00 1987.49\n",
|
|
||||||
"2021-12-26 00:00:00 1924.2\n"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"for i, j in ts:\n",
|
"for i in tst:\n",
|
||||||
" print(i, j)"
|
" print(i)"
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 11,
|
|
||||||
"id": "14c72558-0500-44e4-a893-628a4102ff53",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"2017-01-01 00:00:00 1099.664\n",
|
|
||||||
"2017-02-01 00:00:00 1147.25\n",
|
|
||||||
"2017-03-01 00:00:00 1167.5249999999999\n",
|
|
||||||
"2017-04-01 00:00:00 1205.436\n",
|
|
||||||
"2017-05-01 00:00:00 1285.345\n",
|
|
||||||
"2017-06-01 00:00:00 1226.3175\n",
|
|
||||||
"2017-07-01 00:00:00 1119.366\n",
|
|
||||||
"2017-08-01 00:00:00 1096.86\n",
|
|
||||||
"2017-09-01 00:00:00 1173.1475\n",
|
|
||||||
"2017-10-01 00:00:00 1210.18\n",
|
|
||||||
"2017-11-01 00:00:00 1391.4975\n",
|
|
||||||
"2017-12-01 00:00:00 1473.172\n",
|
|
||||||
"2018-01-01 00:00:00 1543.2475\n",
|
|
||||||
"2018-02-01 00:00:00 1841.935\n",
|
|
||||||
"2018-03-01 00:00:00 1994.7649999999999\n",
|
|
||||||
"2018-04-01 00:00:00 1933.944\n",
|
|
||||||
"2018-05-01 00:00:00 1768.365\n",
|
|
||||||
"2018-06-01 00:00:00 1798.7775000000001\n",
|
|
||||||
"2018-07-01 00:00:00 1602.54\n",
|
|
||||||
"2018-08-01 00:00:00 1468.445\n",
|
|
||||||
"2018-09-01 00:00:00 1534.14\n",
|
|
||||||
"2018-10-01 00:00:00 1545.12\n",
|
|
||||||
"2018-11-01 00:00:00 1517.2875\n",
|
|
||||||
"2018-12-01 00:00:00 1534.112\n",
|
|
||||||
"2019-01-01 00:00:00 1689.6924999999999\n",
|
|
||||||
"2019-02-01 00:00:00 1829.31\n",
|
|
||||||
"2019-03-01 00:00:00 1612.344\n",
|
|
||||||
"2019-04-01 00:00:00 1561.4325\n",
|
|
||||||
"2019-05-01 00:00:00 1639.56\n",
|
|
||||||
"2019-06-01 00:00:00 1562.152\n",
|
|
||||||
"2019-07-01 00:00:00 1405.61\n",
|
|
||||||
"2019-08-01 00:00:00 1351.45\n",
|
|
||||||
"2019-09-01 00:00:00 1322.7\n",
|
|
||||||
"2019-10-01 00:00:00 1333.6025\n",
|
|
||||||
"2019-11-01 00:00:00 1166.5925\n",
|
|
||||||
"2019-12-01 00:00:00 1163.202\n",
|
|
||||||
"2020-01-01 00:00:00 1167.065\n",
|
|
||||||
"2020-02-01 00:00:00 1170.555\n",
|
|
||||||
"2020-03-01 00:00:00 1210.952\n",
|
|
||||||
"2020-04-01 00:00:00 1284.5774999999999\n",
|
|
||||||
"2020-05-01 00:00:00 1216.634\n",
|
|
||||||
"2020-06-01 00:00:00 1272.9099999999999\n",
|
|
||||||
"2020-07-01 00:00:00 1272.22\n",
|
|
||||||
"2020-08-01 00:00:00 1161.09\n",
|
|
||||||
"2020-09-01 00:00:00 1217.0974999999999\n",
|
|
||||||
"2020-10-01 00:00:00 1313.04\n",
|
|
||||||
"2020-11-01 00:00:00 1310.506\n",
|
|
||||||
"2020-12-01 00:00:00 1440.78\n",
|
|
||||||
"2021-01-01 00:00:00 1438.026\n",
|
|
||||||
"2021-02-01 00:00:00 1437.3474999999999\n",
|
|
||||||
"2021-03-01 00:00:00 1524.5225\n",
|
|
||||||
"2021-04-01 00:00:00 1764.155\n",
|
|
||||||
"2021-05-01 00:00:00 1830.142\n",
|
|
||||||
"2021-06-01 00:00:00 1981.4175\n",
|
|
||||||
"2021-07-01 00:00:00 1875.5275000000001\n",
|
|
||||||
"2021-08-01 00:00:00 2023.024\n",
|
|
||||||
"2021-09-01 00:00:00 2212.9825\n",
|
|
||||||
"2021-10-01 00:00:00 2280.428\n",
|
|
||||||
"2021-11-01 00:00:00 2235.4325\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
|
||||||
"prev_date = dates[0]\n",
|
|
||||||
"for date in dates[1:]:\n",
|
|
||||||
" cur_ts = ts[(ts.dates < date) & (ts.dates >= prev_date)]\n",
|
|
||||||
" print(prev_date, cur_ts.mean())\n",
|
|
||||||
" prev_date = date"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -1066,7 +708,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.4"
|
"version": "3.10.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
Loading…
Reference in New Issue
Block a user