Delete load_data.py
Browse files- load_data.py +0 -26
load_data.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
from pathlib import Path
|
| 2 |
-
|
| 3 |
-
import pandas as pd
|
| 4 |
-
|
| 5 |
-
FILE_BASE = "yt_seg"
|
| 6 |
-
PARTITION_BASE = FILE_BASE + ".{}"
|
| 7 |
-
|
| 8 |
-
def _read_segmentation_json(data_file):
|
| 9 |
-
data_df = pd.read_json(data_file, orient='records', lines=True)
|
| 10 |
-
data_df["targets"] = data_df["targets"].str.lstrip("|=") # to enforce string type, in order to avoid truncation of leading zeros
|
| 11 |
-
return data_df
|
| 12 |
-
|
| 13 |
-
def get_data():
|
| 14 |
-
data_file = Path("data", f'{FILE_BASE}.json')
|
| 15 |
-
return _read_segmentation_json(data_file)
|
| 16 |
-
|
| 17 |
-
def get_partition(partition):
|
| 18 |
-
data_file = Path("data", "partitions", PARTITION_BASE.format(partition) + '.json')
|
| 19 |
-
return _read_segmentation_json(data_file)
|
| 20 |
-
|
| 21 |
-
FILE_BASE_TITLE = "yt_seg_titles.{}"
|
| 22 |
-
|
| 23 |
-
def get_title_partition(partition):
|
| 24 |
-
data_file = Path("data", "partitions", FILE_BASE_TITLE.format(partition) + '.json')
|
| 25 |
-
data_df = pd.read_json(data_file, orient='records', lines=True)
|
| 26 |
-
return data_df
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|