Skip to content

Commit 2cb181e

Browse files
committed
09_git.ipynb: 'try' and '%time' line magic do not work together
For some reason using %time line magic inside `try:` ... `except` ... block did not work. Hopefully this change would fix CI errors (PyArrow not installed).
1 parent 43c9c8f commit 2cb181e

File tree

1 file changed

+39
-10
lines changed

1 file changed

+39
-10
lines changed

09_git.ipynb

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2772,26 +2772,55 @@
27722772
"name": "stdout",
27732773
"output_type": "stream",
27742774
"text": [
2775-
"Wall time: 6.8 s\n",
2776-
"Wall time: 5.26 s\n",
2777-
"Wall time: 345 ms\n",
2778-
"Wall time: 674 ms\n",
2779-
"Wall time: 672 ms\n"
2775+
"pickle.gz: Wall time: 6.77 s\n",
2776+
"csv.gz: Wall time: 5.45 s\n",
2777+
"hdf (full): Wall time: 664 ms\n",
2778+
"hdf (appd): Wall time: 840 ms\n"
27802779
]
27812780
}
27822781
],
27832782
"source": [
2783+
"print('pickle.gz: ', end=' ', flush=True)\n",
27842784
"%time graph_info_df.to_pickle('datasets/git-commit_graph.info.pickle.gz')\n",
2785+
"print('csv.gz: ', end=' ', flush=True)\n",
27852786
"%time graph_info_df.to_csv('datasets/git-commit_graph.info.csv.gz')\n",
2786-
"try:\n",
2787-
" #%time graph_info_df.to_feather('datasets/git-commit_graph.df_edgelist.feather')\n",
2788-
" %time graph_info_df.to_parquet('datasets/git-commit_graph.info.parquet')\n",
2789-
"except ImportError:\n",
2790-
" print(\"Missing optional dependency 'pyarrow' required\")\n",
2787+
"print('hdf (full):', end=' ', flush=True)\n",
27912788
"%time graph_info_df.to_hdf('datasets/git-commit_graph.info.hdf5', 'df', mode='w', complevel=6)\n",
2789+
"print('hdf (appd):', end=' ', flush=True)\n",
27922790
"%time graph_info_df.to_hdf('datasets/git-commit_graph.hdf5', 'df_info', mode='a', complevel=6)"
27932791
]
27942792
},
2793+
{
2794+
"cell_type": "code",
2795+
"execution_count": null,
2796+
"metadata": {},
2797+
"outputs": [],
2798+
"source": [
2799+
"# feather does not support non-numerical index, IIRC\n",
2800+
"#%time graph_info_df.to_feather('datasets/git-commit_graph.info.feather')"
2801+
]
2802+
},
2803+
{
2804+
"cell_type": "code",
2805+
"execution_count": null,
2806+
"metadata": {},
2807+
"outputs": [
2808+
{
2809+
"name": "stdout",
2810+
"output_type": "stream",
2811+
"text": [
2812+
"Wall time: 423 ms\n"
2813+
]
2814+
}
2815+
],
2816+
"source": [
2817+
"%%time\n",
2818+
"try:\n",
2819+
" graph_info_df.to_parquet('datasets/git-commit_graph.info.parquet')\n",
2820+
"except ImportError:\n",
2821+
" print(\"Missing optional dependency 'pyarrow' required\")"
2822+
]
2823+
},
27952824
{
27962825
"cell_type": "code",
27972826
"execution_count": null,

0 commit comments

Comments
 (0)