Skip to content

Commit f97a108

Browse files
committed
Improve formatting
1 parent f76fa30 commit f97a108

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

source-code/pandas/pandas_datatypes.ipynb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@
7373
"source": [
7474
"with open(file_path, 'w') as file:\n",
7575
" categories = ''.join(chr(ord('A') + i) for i in range(26))\n",
76-
" print('float1,float2,int1,int2,binary1,binary2,cat1,cat2', file=file)\n",
76+
" print('float1,float2,int1,int2,binary1,binary2,cat1,cat2',\n",
77+
" file=file)\n",
7778
" for _ in range(nr_lines):\n",
7879
" print(f'{random.random()},{random.random()},'\n",
7980
" f'{random.randrange(0, 255)},{random.randrange(0, 255)},'\n",
@@ -686,7 +687,13 @@
686687
"metadata": {},
687688
"outputs": [],
688689
"source": [
689-
"df_typed = pd.read_csv(file_path, dtype={'A': np.uint8, 'B': np.uint8, 'C': np.float32}, index_col=0)"
690+
"df_typed = pd.read_csv(file_path,\n",
691+
" dtype={\n",
692+
" 'A': np.uint8,\n",
693+
" 'B': np.uint8,\n",
694+
" 'C': np.float32\n",
695+
" },\n",
696+
" index_col=0)"
690697
]
691698
},
692699
{
@@ -811,7 +818,7 @@
811818
],
812819
"metadata": {
813820
"kernelspec": {
814-
"display_name": "Python 3",
821+
"display_name": "Python 3 (ipykernel)",
815822
"language": "python",
816823
"name": "python3"
817824
},
@@ -825,7 +832,7 @@
825832
"name": "python",
826833
"nbconvert_exporter": "python",
827834
"pygments_lexer": "ipython3",
828-
"version": "3.7.7"
835+
"version": "3.11.0"
829836
}
830837
},
831838
"nbformat": 4,

source-code/pandas/pivot_versus_pivot_table.ipynb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,9 @@
374374
"metadata": {},
375375
"outputs": [],
376376
"source": [
377-
"time_series_table = data.pivot_table(index='date', columns='patient', values=['dose', 'temperature'])"
377+
"time_series_table = data.pivot_table(index='date',\n",
378+
" columns='patient',\n",
379+
" values=['dose', 'temperature'])"
378380
]
379381
},
380382
{
@@ -923,7 +925,7 @@
923925
"name": "python",
924926
"nbconvert_exporter": "python",
925927
"pygments_lexer": "ipython3",
926-
"version": "3.12.0"
928+
"version": "3.11.0"
927929
}
928930
},
929931
"nbformat": 4,

0 commit comments

Comments
 (0)