IlyaGusev commited on
Commit
66c9469
1 Parent(s): 7241b46

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +24 -26
README.md CHANGED
@@ -171,35 +171,33 @@ for example in dataset:
171
  "reading_time": 1,
172
  "format": null,
173
  "complexity": null,
174
- "comments": [
175
- {
176
- "id": 11653537,
177
- "parent_id": null,
178
- "level": 0,
179
- "time_published": 1185963192,
180
- "score": -1,
181
- "votes": 1,
182
- "message_html": "...",
183
- "author": "...",
184
- "children": [
185
- 11653541
186
- ]
187
- },
188
- {
189
- "id": 11653541,
190
- "parent_id": 11653537,
191
- "level": 1,
192
- "time_published": 1185967886,
193
- "score": 0,
194
- "votes": 0,
195
- "message_html": "...",
196
- "message_markdown": "...",
197
- "author": "..."
198
- }
199
- ]
200
  }
201
  ```
202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
  ## Source Data
205
 
 
171
  "reading_time": 1,
172
  "format": null,
173
  "complexity": null,
174
+ "comments": {
175
+ "id": [11653537, 11653541],
176
+ "parent_id": [null, 11653537],
177
+ "level": [0, 1],
178
+ "time_published": [1185963192, 1185967886],
179
+ "score": [-1, 0],
180
+ "votes": [1, 0],
181
+ "message_html": ["...", "..."],
182
+ "author": ["...", "..."],
183
+ "children": [[11653541], []]
184
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  }
186
  ```
187
 
188
+ You can use this little helper to unflatten sequences:
189
+
190
+ ```python
191
+ def revert_flattening(records):
192
+ fixed_records = []
193
+ for key, values in records.items():
194
+ if not fixed_records:
195
+ fixed_records = [{} for _ in range(len(values))]
196
+ for i, value in enumerate(values):
197
+ fixed_records[i][key] = value
198
+ return fixed_records
199
+ ```
200
+
201
 
202
  ## Source Data
203