Skip to content

Commit c04c537

Browse files
committed
fix folder path not exist bug
1 parent b138304 commit c04c537

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

notebooks/1 - Preprocess Data.ipynb

+24-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
{
1818
"cell_type": "code",
1919
"execution_count": 1,
20-
"metadata": {},
20+
"metadata": {
21+
"collapsed": true
22+
},
2123
"outputs": [],
2224
"source": [
2325
"%load_ext autoreload\n",
@@ -161,7 +163,9 @@
161163
{
162164
"cell_type": "code",
163165
"execution_count": 5,
164-
"metadata": {},
166+
"metadata": {
167+
"collapsed": true
168+
},
165169
"outputs": [],
166170
"source": [
167171
"def tokenize_docstring(text):\n",
@@ -471,7 +475,9 @@
471475
{
472476
"cell_type": "code",
473477
"execution_count": 13,
474-
"metadata": {},
478+
"metadata": {
479+
"collapsed": true
480+
},
475481
"outputs": [],
476482
"source": [
477483
"def listlen(x):\n",
@@ -497,7 +503,9 @@
497503
{
498504
"cell_type": "code",
499505
"execution_count": 14,
500-
"metadata": {},
506+
"metadata": {
507+
"collapsed": true
508+
},
501509
"outputs": [],
502510
"source": [
503511
"grouped = with_docstrings.groupby('nwo')"
@@ -526,7 +534,9 @@
526534
{
527535
"cell_type": "code",
528536
"execution_count": 16,
529-
"metadata": {},
537+
"metadata": {
538+
"collapsed": true
539+
},
530540
"outputs": [],
531541
"source": [
532542
"train = pd.concat([d for _, d in train]).reset_index(drop=True)\n",
@@ -719,7 +729,9 @@
719729
{
720730
"cell_type": "code",
721731
"execution_count": 39,
722-
"metadata": {},
732+
"metadata": {
733+
"collapsed": true
734+
},
723735
"outputs": [],
724736
"source": [
725737
"def write_to(df, filename, path='./data/processed_data/'):\n",
@@ -736,9 +748,14 @@
736748
{
737749
"cell_type": "code",
738750
"execution_count": 40,
739-
"metadata": {},
751+
"metadata": {
752+
"collapsed": true
753+
},
740754
"outputs": [],
741755
"source": [
756+
"import os\n",
757+
"if not os.path.exists('data/'):\n",
758+
" os.makedirs('data/')\n",
742759
"# write to output files\n",
743760
"write_to(train, 'train')\n",
744761
"write_to(valid, 'valid')\n",

0 commit comments

Comments
 (0)