Skip to content

Commit 7bf784b

Browse files
committed
fix: use axis = 0 on concat
1 parent b3d10c2 commit 7bf784b

File tree

1 file changed

+57
-39
lines changed

1 file changed

+57
-39
lines changed

notebooks/sn03_aggregate_data.ipynb

Lines changed: 57 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 83,
5+
"execution_count": 1,
66
"id": "d69d493a-0716-47e7-bc80-0ef36753fdf8",
77
"metadata": {},
88
"outputs": [],
@@ -54,7 +54,7 @@
5454
},
5555
{
5656
"cell_type": "code",
57-
"execution_count": 84,
57+
"execution_count": 2,
5858
"id": "7302bac8-3643-4701-a1af-ea028dc8af38",
5959
"metadata": {},
6060
"outputs": [],
@@ -80,7 +80,7 @@
8080
},
8181
{
8282
"cell_type": "code",
83-
"execution_count": 85,
83+
"execution_count": 3,
8484
"id": "d93c4011-0731-4992-9863-c198d570e18e",
8585
"metadata": {},
8686
"outputs": [
@@ -302,7 +302,7 @@
302302
},
303303
{
304304
"cell_type": "code",
305-
"execution_count": 86,
305+
"execution_count": 4,
306306
"id": "5ed00545-9d1e-4521-9d44-c6da89d5e4e5",
307307
"metadata": {},
308308
"outputs": [
@@ -544,7 +544,7 @@
544544
},
545545
{
546546
"cell_type": "code",
547-
"execution_count": 87,
547+
"execution_count": 5,
548548
"id": "9c93b32b-443e-4321-80fa-3d46fa8a0b1d",
549549
"metadata": {},
550550
"outputs": [
@@ -722,7 +722,7 @@
722722
},
723723
{
724724
"cell_type": "code",
725-
"execution_count": 88,
725+
"execution_count": 6,
726726
"id": "afb85718-4c7a-42e5-8531-bb93bcf1efff",
727727
"metadata": {},
728728
"outputs": [
@@ -892,7 +892,7 @@
892892
},
893893
{
894894
"cell_type": "code",
895-
"execution_count": 89,
895+
"execution_count": 7,
896896
"id": "678f7d00-74f2-4632-a56b-d672ae8a1d7b",
897897
"metadata": {},
898898
"outputs": [
@@ -1021,7 +1021,7 @@
10211021
},
10221022
{
10231023
"cell_type": "code",
1024-
"execution_count": 90,
1024+
"execution_count": 8,
10251025
"id": "4498ac73-7544-4b25-bc6c-86f416d0a4a5",
10261026
"metadata": {},
10271027
"outputs": [
@@ -1155,7 +1155,7 @@
11551155
},
11561156
{
11571157
"cell_type": "code",
1158-
"execution_count": 91,
1158+
"execution_count": 9,
11591159
"id": "ca5cdd55-b50e-4033-80e9-dd8c6cd151e9",
11601160
"metadata": {},
11611161
"outputs": [
@@ -1314,7 +1314,7 @@
13141314
},
13151315
{
13161316
"cell_type": "code",
1317-
"execution_count": 92,
1317+
"execution_count": 10,
13181318
"id": "8e13801e-7aa1-46bc-9091-d799e99ea5e6",
13191319
"metadata": {},
13201320
"outputs": [
@@ -1465,7 +1465,7 @@
14651465
},
14661466
{
14671467
"cell_type": "code",
1468-
"execution_count": 93,
1468+
"execution_count": 11,
14691469
"id": "362ec550-c17f-46ba-a8d6-67e31a4f6e71",
14701470
"metadata": {},
14711471
"outputs": [
@@ -1562,7 +1562,7 @@
15621562
},
15631563
{
15641564
"cell_type": "code",
1565-
"execution_count": 94,
1565+
"execution_count": 12,
15661566
"id": "9f70f39c-fad1-475b-ac63-a3a69483e0ea",
15671567
"metadata": {},
15681568
"outputs": [
@@ -1680,7 +1680,7 @@
16801680
},
16811681
{
16821682
"cell_type": "code",
1683-
"execution_count": 95,
1683+
"execution_count": 13,
16841684
"id": "b4d18ba9-1d7d-401c-babe-9acd86135f66",
16851685
"metadata": {},
16861686
"outputs": [
@@ -1705,7 +1705,7 @@
17051705
},
17061706
{
17071707
"cell_type": "code",
1708-
"execution_count": 96,
1708+
"execution_count": 14,
17091709
"id": "97039742-2ca5-4d00-9933-ef26f555faa5",
17101710
"metadata": {},
17111711
"outputs": [
@@ -1755,7 +1755,7 @@
17551755
"2021-08-05 West 35.0"
17561756
]
17571757
},
1758-
"execution_count": 96,
1758+
"execution_count": 14,
17591759
"metadata": {},
17601760
"output_type": "execute_result"
17611761
}
@@ -1767,7 +1767,7 @@
17671767
},
17681768
{
17691769
"cell_type": "code",
1770-
"execution_count": 97,
1770+
"execution_count": 15,
17711771
"id": "107452d1-04fe-4712-9c20-cf8d08b91c57",
17721772
"metadata": {},
17731773
"outputs": [
@@ -1788,7 +1788,7 @@
17881788
},
17891789
{
17901790
"cell_type": "code",
1791-
"execution_count": 98,
1791+
"execution_count": 16,
17921792
"id": "7fb68d61-ca0f-4e13-a449-c28118a42692",
17931793
"metadata": {},
17941794
"outputs": [],
@@ -1799,7 +1799,7 @@
17991799
},
18001800
{
18011801
"cell_type": "code",
1802-
"execution_count": 99,
1802+
"execution_count": 24,
18031803
"id": "63ce9c68-9a43-4120-9f6c-d76aa7ea9411",
18041804
"metadata": {},
18051805
"outputs": [
@@ -1824,66 +1824,71 @@
18241824
" <thead>\n",
18251825
" <tr style=\"text-align: right;\">\n",
18261826
" <th></th>\n",
1827+
" <th></th>\n",
18271828
" <th>Total</th>\n",
18281829
" </tr>\n",
18291830
" </thead>\n",
18301831
" <tbody>\n",
18311832
" <tr>\n",
1832-
" <th>0</th>\n",
1833+
" <th rowspan=\"2\" valign=\"top\">2021-08-04</th>\n",
1834+
" <th>East</th>\n",
18331835
" <td>97.0</td>\n",
18341836
" </tr>\n",
18351837
" <tr>\n",
1836-
" <th>1</th>\n",
1838+
" <th>West</th>\n",
18371839
" <td>243.0</td>\n",
18381840
" </tr>\n",
18391841
" <tr>\n",
1840-
" <th>2</th>\n",
1842+
" <th rowspan=\"2\" valign=\"top\">2021-08-05</th>\n",
1843+
" <th>East</th>\n",
18411844
" <td>160.0</td>\n",
18421845
" </tr>\n",
18431846
" <tr>\n",
1844-
" <th>3</th>\n",
1847+
" <th>West</th>\n",
18451848
" <td>35.0</td>\n",
18461849
" </tr>\n",
18471850
" <tr>\n",
1848-
" <th>4</th>\n",
1851+
" <th rowspan=\"2\" valign=\"top\">2021-08-06</th>\n",
1852+
" <th>East</th>\n",
18491853
" <td>110.0</td>\n",
18501854
" </tr>\n",
18511855
" <tr>\n",
1852-
" <th>5</th>\n",
1856+
" <th>West</th>\n",
18531857
" <td>86.0</td>\n",
18541858
" </tr>\n",
18551859
" <tr>\n",
1856-
" <th>6</th>\n",
1860+
" <th>Grand Total</th>\n",
1861+
" <th>Grand Total</th>\n",
18571862
" <td>731.0</td>\n",
18581863
" </tr>\n",
18591864
" </tbody>\n",
18601865
"</table>\n",
18611866
"</div>"
18621867
],
18631868
"text/plain": [
1864-
" Total\n",
1865-
"0 97.0\n",
1866-
"1 243.0\n",
1867-
"2 160.0\n",
1868-
"3 35.0\n",
1869-
"4 110.0\n",
1870-
"5 86.0\n",
1871-
"6 731.0"
1869+
" Total\n",
1870+
"2021-08-04 East 97.0\n",
1871+
" West 243.0\n",
1872+
"2021-08-05 East 160.0\n",
1873+
" West 35.0\n",
1874+
"2021-08-06 East 110.0\n",
1875+
" West 86.0\n",
1876+
"Grand Total Grand Total 731.0"
18721877
]
18731878
},
18741879
"metadata": {},
18751880
"output_type": "display_data"
18761881
}
18771882
],
18781883
"source": [
1879-
"df_date_region_total = pd.concat([df_date_region_agg, pd.DataFrame([grand_total_series])], ignore_index=True)\n",
1884+
"df_date_region_total = pd.concat([df_date_region_agg, pd.DataFrame([grand_total_series])], axis = 0)\n",
18801885
"\n",
18811886
"display(df_date_region_total)"
18821887
]
18831888
},
18841889
{
18851890
"cell_type": "code",
1886-
"execution_count": 101,
1891+
"execution_count": 28,
18871892
"id": "5388e301-e18a-450e-bd1b-adfdac02ad65",
18881893
"metadata": {},
18891894
"outputs": [
@@ -1908,28 +1913,41 @@
19081913
" <thead>\n",
19091914
" <tr style=\"text-align: right;\">\n",
19101915
" <th></th>\n",
1916+
" <th></th>\n",
19111917
" <th>Total</th>\n",
19121918
" </tr>\n",
19131919
" </thead>\n",
19141920
" <tbody>\n",
1921+
" <tr>\n",
1922+
" <th>Grand Total</th>\n",
1923+
" <th>Grand Total</th>\n",
1924+
" <td>731.0</td>\n",
1925+
" </tr>\n",
19151926
" </tbody>\n",
19161927
"</table>\n",
19171928
"</div>"
19181929
],
19191930
"text/plain": [
1920-
"Empty DataFrame\n",
1921-
"Columns: [Total]\n",
1922-
"Index: []"
1931+
" Total\n",
1932+
"Grand Total Grand Total 731.0"
19231933
]
19241934
},
1925-
"execution_count": 101,
1935+
"execution_count": 28,
19261936
"metadata": {},
19271937
"output_type": "execute_result"
19281938
}
19291939
],
19301940
"source": [
19311941
"df_date_region_total[df_date_region_total.index.isin([('Grand Total', 'Grand Total')])]"
19321942
]
1943+
},
1944+
{
1945+
"cell_type": "code",
1946+
"execution_count": null,
1947+
"id": "02c6b214-64cf-4bf5-b207-1857151b6096",
1948+
"metadata": {},
1949+
"outputs": [],
1950+
"source": []
19331951
}
19341952
],
19351953
"metadata": {

0 commit comments

Comments
 (0)