Datasets:

Modalities:
Text
Size:
< 1K
Libraries:
Datasets
License:
Zaid commited on
Commit
d2d59a4
1 Parent(s): d6c7af4

Update masader.py

Browse files
Files changed (1) hide show
  1. masader.py +7 -3
masader.py CHANGED
@@ -131,9 +131,13 @@ class Masader(datasets.GeneratorBasedBuilder):
131
  i = 0
132
  idx = 0
133
 
134
- while i < len(df.values) - 1:
135
 
136
- next_entry = df.values[i+1]
 
 
 
 
137
  curr_entry = df.values[i]
138
 
139
  i+= 1
@@ -141,7 +145,7 @@ class Masader(datasets.GeneratorBasedBuilder):
141
  entry_list = curr_entry
142
  subsets = []
143
 
144
- if str(next_entry[0]) == "nan":
145
  subsets.append({'Name': next_entry[2], 'Dialect':next_entry[8], 'Volume':next_entry[13], 'Unit':next_entry[14]})
146
  continue
147
  idx += 1
 
131
  i = 0
132
  idx = 0
133
 
134
+ while i < len(df.values):
135
 
136
+ if i < len(df.values) - 1:
137
+ next_entry = df.values[i+1]
138
+ else:
139
+ next_entry = []
140
+
141
  curr_entry = df.values[i]
142
 
143
  i+= 1
 
145
  entry_list = curr_entry
146
  subsets = []
147
 
148
+ if len(next_entry) > 0 and str(next_entry[0]) == "nan":
149
  subsets.append({'Name': next_entry[2], 'Dialect':next_entry[8], 'Volume':next_entry[13], 'Unit':next_entry[14]})
150
  continue
151
  idx += 1