update dataset files
Browse files- NASA_OSDR.py +5 -13
- data/train/experiments.json +0 -3
- data/train/samples.json +0 -3
- tests/test_nasa_osdr.py +2 -2
NASA_OSDR.py
CHANGED
|
@@ -529,7 +529,7 @@ class NasaOsdr(datasets.GeneratorBasedBuilder):
|
|
| 529 |
downloaded_files = dl_manager.download_and_extract(
|
| 530 |
{
|
| 531 |
"train": {
|
| 532 |
-
"file": os.path.join(self.config.data_url, 'train/samples.
|
| 533 |
},
|
| 534 |
}
|
| 535 |
)
|
|
@@ -544,15 +544,7 @@ class NasaOsdr(datasets.GeneratorBasedBuilder):
|
|
| 544 |
]
|
| 545 |
|
| 546 |
def _generate_examples(self, file: str):
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
# _item = {**row.to_dict()}
|
| 552 |
-
# yield idx, _ite
|
| 553 |
-
|
| 554 |
-
import json
|
| 555 |
-
with open(file, 'r') as file:
|
| 556 |
-
for idx, line in enumerate(file):
|
| 557 |
-
line_data = json.loads(line)
|
| 558 |
-
yield idx, line_data
|
|
|
|
| 529 |
downloaded_files = dl_manager.download_and_extract(
|
| 530 |
{
|
| 531 |
"train": {
|
| 532 |
+
"file": os.path.join(self.config.data_url, 'train/samples.csv'),
|
| 533 |
},
|
| 534 |
}
|
| 535 |
)
|
|
|
|
| 544 |
]
|
| 545 |
|
| 546 |
def _generate_examples(self, file: str):
|
| 547 |
+
df = pd.read_csv(file, index_col=0, low_memory=False)
|
| 548 |
+
for idx, row in df.iterrows():
|
| 549 |
+
_item = {**row.to_dict()}
|
| 550 |
+
yield idx, _item
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/train/experiments.json
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:586a3964123e2be44e80c272b9525b37b2bc2ad55a55fd3f75298b962e9cc6a4
|
| 3 |
-
size 281085
|
|
|
|
|
|
|
|
|
|
|
|
data/train/samples.json
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:a9ed0ecf965eb91a9f475b8190896b558a6d17079dad467fc1ba1ed23e5c19b7
|
| 3 |
-
size 868940262
|
|
|
|
|
|
|
|
|
|
|
|
tests/test_nasa_osdr.py
CHANGED
|
@@ -33,12 +33,12 @@ def test_inherit_generator_base_builder_works():
|
|
| 33 |
|
| 34 |
def test_generate_examples():
|
| 35 |
dataset = NasaOsdr(name='experiments')
|
| 36 |
-
train_data = dataset._generate_examples(file='data/train/experiments.
|
| 37 |
idx, sample = next(iter(train_data))
|
| 38 |
print(idx, sample.keys())
|
| 39 |
|
| 40 |
dataset = NasaOsdr(name='samples')
|
| 41 |
-
train_data = dataset._generate_examples(file='data/train/samples.
|
| 42 |
idx, sample = next(iter(train_data))
|
| 43 |
print(idx, sample.keys())
|
| 44 |
|
|
|
|
| 33 |
|
| 34 |
def test_generate_examples():
|
| 35 |
dataset = NasaOsdr(name='experiments')
|
| 36 |
+
train_data = dataset._generate_examples(file='data/train/experiments.csv')
|
| 37 |
idx, sample = next(iter(train_data))
|
| 38 |
print(idx, sample.keys())
|
| 39 |
|
| 40 |
dataset = NasaOsdr(name='samples')
|
| 41 |
+
train_data = dataset._generate_examples(file='data/train/samples.csv')
|
| 42 |
idx, sample = next(iter(train_data))
|
| 43 |
print(idx, sample.keys())
|
| 44 |
|