Skip to content

Commit b96c2ac

Browse files
committed
Create split file directory and write with indent
1 parent d775f84 commit b96c2ac

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

datastream/dataset.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,12 @@ def split(
206206
... )))
207207
... .split(
208208
... key_column='index',
209-
... proportions=dict(
210-
... train=0.7,
211-
... early_stopping=0.1,
212-
... public_test=0.1,
213-
... private_test=0.1,
214-
... ),
209+
... proportions=dict(train=0.8, test=0.2),
215210
... filepath=split_file,
216211
... )
217212
... )
218213
>>> len(split_datasets['train'])
219-
70
214+
80
220215
>>> split_file.unlink() # clean up after doctest
221216
'''
222217
if filepath is not None:

datastream/tools/split_dataframes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ def split_dataframes(
7272
split[last_split_name] += unassigned(dataframe[key_column], split)
7373

7474
if filepath is not None:
75-
filepath.write_text(json.dumps(split))
75+
filepath.parent.mkdir(parents=True, exist_ok=True)
76+
filepath.write_text(json.dumps(split, indent=4))
7677

7778
return {
7879
split_name: (

0 commit comments

Comments
 (0)