blinoff commited on
Commit
17110eb
1 Parent(s): 97ee3fb

Update healthcare_facilities_reviews.py

Browse files
Files changed (1) hide show
  1. healthcare_facilities_reviews.py +7 -9
healthcare_facilities_reviews.py CHANGED
@@ -1,5 +1,5 @@
1
  import datasets
2
- import pandas as pd
3
 
4
  class HfreviewsConfig(datasets.BuilderConfig):
5
  def __init__(self, features, **kwargs):
@@ -46,11 +46,9 @@ class HealthcareFacilitiesReviews(datasets.GeneratorBasedBuilder):
46
  ]
47
 
48
  def _generate_examples(self, filepath):
49
- df = pd.read_json(filepath, lines=True)
50
- rows = df.to_dict(orient="records")
51
-
52
- for n, row in enumerate(rows):
53
- example = row
54
- example["Idx"] = n
55
-
56
- yield example["Idx"], example
 
1
  import datasets
2
+ import json
3
 
4
  class HfreviewsConfig(datasets.BuilderConfig):
5
  def __init__(self, features, **kwargs):
 
46
  ]
47
 
48
  def _generate_examples(self, filepath):
49
+ """Yields examples."""
50
+ with open(filepath, encoding="utf-8") as f:
51
+ for uid, row in enumerate(f):
52
+ data = json.loads(row)
53
+ data["Idx"] = uid
54
+ yield uid, data