Datasets:

Modalities:
Text
Formats:
parquet
Libraries:
Datasets
pandas
License:
c4lliope commited on
Commit
9342939
1 Parent(s): 4322569

Add example, loading a `.parquet` dataset.

Browse files
Files changed (1) hide show
  1. parquet.ipynb +1162 -0
parquet.ipynb ADDED
@@ -0,0 +1,1162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 31,
6
+ "id": "6c4898b7",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import pandas as pd\n",
11
+ "import json\n",
12
+ "from pathlib import Path\n",
13
+ "from datasets import load_dataset"
14
+ ]
15
+ },
16
+ {
17
+ "cell_type": "code",
18
+ "execution_count": 2,
19
+ "id": "e8f4075f",
20
+ "metadata": {},
21
+ "outputs": [],
22
+ "source": [
23
+ "# !ls records/session/118/bill/hr1.*\n",
24
+ "base = Path(\"records/session/118/bill\")"
25
+ ]
26
+ },
27
+ {
28
+ "cell_type": "code",
29
+ "execution_count": 3,
30
+ "id": "423587ee",
31
+ "metadata": {},
32
+ "outputs": [
33
+ {
34
+ "data": {
35
+ "text/plain": [
36
+ "16971"
37
+ ]
38
+ },
39
+ "execution_count": 3,
40
+ "metadata": {},
41
+ "output_type": "execute_result"
42
+ }
43
+ ],
44
+ "source": [
45
+ "bills = sorted(list(base.glob('*')))\n",
46
+ "len(bills)"
47
+ ]
48
+ },
49
+ {
50
+ "cell_type": "code",
51
+ "execution_count": 4,
52
+ "id": "980385c7",
53
+ "metadata": {},
54
+ "outputs": [],
55
+ "source": [
56
+ "p = bills[0]"
57
+ ]
58
+ },
59
+ {
60
+ "cell_type": "code",
61
+ "execution_count": 5,
62
+ "id": "d3f4a030",
63
+ "metadata": {},
64
+ "outputs": [
65
+ {
66
+ "data": {
67
+ "text/plain": [
68
+ "['hconres1', '2023-03-17T17-45-06Z']"
69
+ ]
70
+ },
71
+ "execution_count": 5,
72
+ "metadata": {},
73
+ "output_type": "execute_result"
74
+ }
75
+ ],
76
+ "source": [
77
+ "p.parts[-1].split('.')"
78
+ ]
79
+ },
80
+ {
81
+ "cell_type": "code",
82
+ "execution_count": 6,
83
+ "id": "0c7c740b",
84
+ "metadata": {},
85
+ "outputs": [],
86
+ "source": [
87
+ "bits = []\n",
88
+ "for p in bills:\n",
89
+ " bits.append([p, *p.parts[-1].split('.')])"
90
+ ]
91
+ },
92
+ {
93
+ "cell_type": "code",
94
+ "execution_count": 7,
95
+ "id": "028480f8",
96
+ "metadata": {},
97
+ "outputs": [],
98
+ "source": [
99
+ "paths = pd.DataFrame(bits, columns=['path', 'key', 'date']).sort_values(['key', 'date'])"
100
+ ]
101
+ },
102
+ {
103
+ "cell_type": "code",
104
+ "execution_count": 8,
105
+ "id": "4f0f546b",
106
+ "metadata": {},
107
+ "outputs": [],
108
+ "source": [
109
+ "measures = paths.groupby('key').last()"
110
+ ]
111
+ },
112
+ {
113
+ "cell_type": "code",
114
+ "execution_count": 25,
115
+ "id": "84f1767f",
116
+ "metadata": {},
117
+ "outputs": [
118
+ {
119
+ "data": {
120
+ "text/html": [
121
+ "<div>\n",
122
+ "<style scoped>\n",
123
+ " .dataframe tbody tr th:only-of-type {\n",
124
+ " vertical-align: middle;\n",
125
+ " }\n",
126
+ "\n",
127
+ " .dataframe tbody tr th {\n",
128
+ " vertical-align: top;\n",
129
+ " }\n",
130
+ "\n",
131
+ " .dataframe thead th {\n",
132
+ " text-align: right;\n",
133
+ " }\n",
134
+ "</style>\n",
135
+ "<table border=\"1\" class=\"dataframe\">\n",
136
+ " <thead>\n",
137
+ " <tr style=\"text-align: right;\">\n",
138
+ " <th></th>\n",
139
+ " <th>actions</th>\n",
140
+ " <th>amendments</th>\n",
141
+ " <th>committees</th>\n",
142
+ " <th>cosponsors</th>\n",
143
+ " <th>index</th>\n",
144
+ " <th>relatedbills</th>\n",
145
+ " <th>subjects</th>\n",
146
+ " <th>summaries</th>\n",
147
+ " <th>text</th>\n",
148
+ " <th>titles</th>\n",
149
+ " </tr>\n",
150
+ " </thead>\n",
151
+ " <tbody>\n",
152
+ " <tr>\n",
153
+ " <th>0</th>\n",
154
+ " <td>{'actions': [{'actionDate': '2023-01-23', 'sou...</td>\n",
155
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
156
+ " <td>{'committees': [], 'request': {'billNumber': '...</td>\n",
157
+ " <td>{'cosponsors': [], 'pagination': {'count': 0, ...</td>\n",
158
+ " <td>{'bill': {'actions': {'count': 7, 'url': 'http...</td>\n",
159
+ " <td>{'pagination': {'count': 0}, 'relatedBills': [...</td>\n",
160
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
161
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
162
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
163
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
164
+ " </tr>\n",
165
+ " <tr>\n",
166
+ " <th>1</th>\n",
167
+ " <td>{'actions': [{'actionCode': 'H11100', 'actionD...</td>\n",
168
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
169
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
170
+ " <td>{'cosponsors': [{'bioguideId': 'P000605', 'dis...</td>\n",
171
+ " <td>{'bill': {'actions': {'count': 4, 'url': 'http...</td>\n",
172
+ " <td>{'pagination': {'count': 0}, 'relatedBills': [...</td>\n",
173
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
174
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
175
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
176
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
177
+ " </tr>\n",
178
+ " <tr>\n",
179
+ " <th>2</th>\n",
180
+ " <td>{'actions': [{'actionDate': '2023-02-02', 'sou...</td>\n",
181
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
182
+ " <td>{'committees': [], 'request': {'billNumber': '...</td>\n",
183
+ " <td>{'cosponsors': [], 'pagination': {'count': 0, ...</td>\n",
184
+ " <td>{'bill': {'actions': {'count': 10, 'url': 'htt...</td>\n",
185
+ " <td>{'pagination': {'count': 0}, 'relatedBills': [...</td>\n",
186
+ " <td>{'pagination': {'count': 3}, 'request': {'bill...</td>\n",
187
+ " <td>{'pagination': {'count': 3}, 'request': {'bill...</td>\n",
188
+ " <td>{'pagination': {'count': 3}, 'request': {'bill...</td>\n",
189
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
190
+ " </tr>\n",
191
+ " <tr>\n",
192
+ " <th>3</th>\n",
193
+ " <td>{'actions': [{'actionCode': 'H11000', 'actionD...</td>\n",
194
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
195
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
196
+ " <td>{'cosponsors': [{'bioguideId': 'K000380', 'dis...</td>\n",
197
+ " <td>{'bill': {'actions': {'count': 5, 'url': 'http...</td>\n",
198
+ " <td>{'pagination': {'count': 0}, 'relatedBills': [...</td>\n",
199
+ " <td>{'pagination': {'count': 6}, 'request': {'bill...</td>\n",
200
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
201
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
202
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
203
+ " </tr>\n",
204
+ " <tr>\n",
205
+ " <th>4</th>\n",
206
+ " <td>{'actions': [{'actionCode': 'H11100', 'actionD...</td>\n",
207
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
208
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
209
+ " <td>{'cosponsors': [{'bioguideId': 'C001066', 'dis...</td>\n",
210
+ " <td>{'bill': {'actions': {'count': 3, 'url': 'http...</td>\n",
211
+ " <td>{'pagination': {'count': 1}, 'relatedBills': [...</td>\n",
212
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
213
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
214
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
215
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
216
+ " </tr>\n",
217
+ " <tr>\n",
218
+ " <th>...</th>\n",
219
+ " <td>...</td>\n",
220
+ " <td>...</td>\n",
221
+ " <td>...</td>\n",
222
+ " <td>...</td>\n",
223
+ " <td>...</td>\n",
224
+ " <td>...</td>\n",
225
+ " <td>...</td>\n",
226
+ " <td>...</td>\n",
227
+ " <td>...</td>\n",
228
+ " <td>...</td>\n",
229
+ " </tr>\n",
230
+ " <tr>\n",
231
+ " <th>6070</th>\n",
232
+ " <td>{'actions': [{'actionDate': '2023-03-07', 'com...</td>\n",
233
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
234
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
235
+ " <td>{'cosponsors': [{'bioguideId': 'W000817', 'fir...</td>\n",
236
+ " <td>{'bill': {'actions': {'count': 2, 'url': 'http...</td>\n",
237
+ " <td>{'pagination': {'count': 1}, 'relatedBills': [...</td>\n",
238
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
239
+ " <td>{'pagination': {'count': 0}, 'request': {'bill...</td>\n",
240
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
241
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
242
+ " </tr>\n",
243
+ " <tr>\n",
244
+ " <th>6071</th>\n",
245
+ " <td>{'actions': [{'actionDate': '2023-03-08', 'com...</td>\n",
246
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
247
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
248
+ " <td>{'cosponsors': [{'bioguideId': 'C000141', 'fir...</td>\n",
249
+ " <td>{'bill': {'actions': {'count': 2, 'url': 'http...</td>\n",
250
+ " <td>{'pagination': {'count': 0}, 'relatedBills': [...</td>\n",
251
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
252
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
253
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
254
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
255
+ " </tr>\n",
256
+ " <tr>\n",
257
+ " <th>6072</th>\n",
258
+ " <td>{'actions': [{'actionDate': '2023-03-08', 'com...</td>\n",
259
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
260
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
261
+ " <td>{'cosponsors': [{'bioguideId': 'H000601', 'fir...</td>\n",
262
+ " <td>{'bill': {'actions': {'count': 2, 'url': 'http...</td>\n",
263
+ " <td>{'pagination': {'count': 0}, 'relatedBills': [...</td>\n",
264
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
265
+ " <td>{'pagination': {'count': 0}, 'request': {'bill...</td>\n",
266
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
267
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
268
+ " </tr>\n",
269
+ " <tr>\n",
270
+ " <th>6073</th>\n",
271
+ " <td>{'actions': [{'actionDate': '2023-03-08', 'com...</td>\n",
272
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
273
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
274
+ " <td>{'cosponsors': [{'bioguideId': 'B001267', 'fir...</td>\n",
275
+ " <td>{'bill': {'actions': {'count': 2, 'url': 'http...</td>\n",
276
+ " <td>{'pagination': {'count': 1}, 'relatedBills': [...</td>\n",
277
+ " <td>{'pagination': {'count': 5}, 'request': {'bill...</td>\n",
278
+ " <td>{'pagination': {'count': 0}, 'request': {'bill...</td>\n",
279
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
280
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
281
+ " </tr>\n",
282
+ " <tr>\n",
283
+ " <th>6074</th>\n",
284
+ " <td>{'actions': [{'actionDate': '2023-05-10', 'sou...</td>\n",
285
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
286
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
287
+ " <td>{'cosponsors': [{'bioguideId': 'C001035', 'fir...</td>\n",
288
+ " <td>{'bill': {'actions': {'count': 7, 'url': 'http...</td>\n",
289
+ " <td>{'pagination': {'count': 0}, 'relatedBills': [...</td>\n",
290
+ " <td>{'pagination': {'count': 11}, 'request': {'bil...</td>\n",
291
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
292
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
293
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
294
+ " </tr>\n",
295
+ " </tbody>\n",
296
+ "</table>\n",
297
+ "<p>6075 rows × 10 columns</p>\n",
298
+ "</div>"
299
+ ],
300
+ "text/plain": [
301
+ " actions \n",
302
+ "0 {'actions': [{'actionDate': '2023-01-23', 'sou... \\\n",
303
+ "1 {'actions': [{'actionCode': 'H11100', 'actionD... \n",
304
+ "2 {'actions': [{'actionDate': '2023-02-02', 'sou... \n",
305
+ "3 {'actions': [{'actionCode': 'H11000', 'actionD... \n",
306
+ "4 {'actions': [{'actionCode': 'H11100', 'actionD... \n",
307
+ "... ... \n",
308
+ "6070 {'actions': [{'actionDate': '2023-03-07', 'com... \n",
309
+ "6071 {'actions': [{'actionDate': '2023-03-08', 'com... \n",
310
+ "6072 {'actions': [{'actionDate': '2023-03-08', 'com... \n",
311
+ "6073 {'actions': [{'actionDate': '2023-03-08', 'com... \n",
312
+ "6074 {'actions': [{'actionDate': '2023-05-10', 'sou... \n",
313
+ "\n",
314
+ " amendments \n",
315
+ "0 {'amendments': [], 'pagination': {'count': 0},... \\\n",
316
+ "1 {'amendments': [], 'pagination': {'count': 0},... \n",
317
+ "2 {'amendments': [], 'pagination': {'count': 0},... \n",
318
+ "3 {'amendments': [], 'pagination': {'count': 0},... \n",
319
+ "4 {'amendments': [], 'pagination': {'count': 0},... \n",
320
+ "... ... \n",
321
+ "6070 {'amendments': [], 'pagination': {'count': 0},... \n",
322
+ "6071 {'amendments': [], 'pagination': {'count': 0},... \n",
323
+ "6072 {'amendments': [], 'pagination': {'count': 0},... \n",
324
+ "6073 {'amendments': [], 'pagination': {'count': 0},... \n",
325
+ "6074 {'amendments': [], 'pagination': {'count': 0},... \n",
326
+ "\n",
327
+ " committees \n",
328
+ "0 {'committees': [], 'request': {'billNumber': '... \\\n",
329
+ "1 {'committees': [{'activities': [{'date': '2023... \n",
330
+ "2 {'committees': [], 'request': {'billNumber': '... \n",
331
+ "3 {'committees': [{'activities': [{'date': '2023... \n",
332
+ "4 {'committees': [{'activities': [{'date': '2023... \n",
333
+ "... ... \n",
334
+ "6070 {'committees': [{'activities': [{'date': '2023... \n",
335
+ "6071 {'committees': [{'activities': [{'date': '2023... \n",
336
+ "6072 {'committees': [{'activities': [{'date': '2023... \n",
337
+ "6073 {'committees': [{'activities': [{'date': '2023... \n",
338
+ "6074 {'committees': [{'activities': [{'date': '2023... \n",
339
+ "\n",
340
+ " cosponsors \n",
341
+ "0 {'cosponsors': [], 'pagination': {'count': 0, ... \\\n",
342
+ "1 {'cosponsors': [{'bioguideId': 'P000605', 'dis... \n",
343
+ "2 {'cosponsors': [], 'pagination': {'count': 0, ... \n",
344
+ "3 {'cosponsors': [{'bioguideId': 'K000380', 'dis... \n",
345
+ "4 {'cosponsors': [{'bioguideId': 'C001066', 'dis... \n",
346
+ "... ... \n",
347
+ "6070 {'cosponsors': [{'bioguideId': 'W000817', 'fir... \n",
348
+ "6071 {'cosponsors': [{'bioguideId': 'C000141', 'fir... \n",
349
+ "6072 {'cosponsors': [{'bioguideId': 'H000601', 'fir... \n",
350
+ "6073 {'cosponsors': [{'bioguideId': 'B001267', 'fir... \n",
351
+ "6074 {'cosponsors': [{'bioguideId': 'C001035', 'fir... \n",
352
+ "\n",
353
+ " index \n",
354
+ "0 {'bill': {'actions': {'count': 7, 'url': 'http... \\\n",
355
+ "1 {'bill': {'actions': {'count': 4, 'url': 'http... \n",
356
+ "2 {'bill': {'actions': {'count': 10, 'url': 'htt... \n",
357
+ "3 {'bill': {'actions': {'count': 5, 'url': 'http... \n",
358
+ "4 {'bill': {'actions': {'count': 3, 'url': 'http... \n",
359
+ "... ... \n",
360
+ "6070 {'bill': {'actions': {'count': 2, 'url': 'http... \n",
361
+ "6071 {'bill': {'actions': {'count': 2, 'url': 'http... \n",
362
+ "6072 {'bill': {'actions': {'count': 2, 'url': 'http... \n",
363
+ "6073 {'bill': {'actions': {'count': 2, 'url': 'http... \n",
364
+ "6074 {'bill': {'actions': {'count': 7, 'url': 'http... \n",
365
+ "\n",
366
+ " relatedbills \n",
367
+ "0 {'pagination': {'count': 0}, 'relatedBills': [... \\\n",
368
+ "1 {'pagination': {'count': 0}, 'relatedBills': [... \n",
369
+ "2 {'pagination': {'count': 0}, 'relatedBills': [... \n",
370
+ "3 {'pagination': {'count': 0}, 'relatedBills': [... \n",
371
+ "4 {'pagination': {'count': 1}, 'relatedBills': [... \n",
372
+ "... ... \n",
373
+ "6070 {'pagination': {'count': 1}, 'relatedBills': [... \n",
374
+ "6071 {'pagination': {'count': 0}, 'relatedBills': [... \n",
375
+ "6072 {'pagination': {'count': 0}, 'relatedBills': [... \n",
376
+ "6073 {'pagination': {'count': 1}, 'relatedBills': [... \n",
377
+ "6074 {'pagination': {'count': 0}, 'relatedBills': [... \n",
378
+ "\n",
379
+ " subjects \n",
380
+ "0 {'pagination': {'count': 2}, 'request': {'bill... \\\n",
381
+ "1 {'pagination': {'count': 1}, 'request': {'bill... \n",
382
+ "2 {'pagination': {'count': 3}, 'request': {'bill... \n",
383
+ "3 {'pagination': {'count': 6}, 'request': {'bill... \n",
384
+ "4 {'pagination': {'count': 2}, 'request': {'bill... \n",
385
+ "... ... \n",
386
+ "6070 {'pagination': {'count': 1}, 'request': {'bill... \n",
387
+ "6071 {'pagination': {'count': 1}, 'request': {'bill... \n",
388
+ "6072 {'pagination': {'count': 1}, 'request': {'bill... \n",
389
+ "6073 {'pagination': {'count': 5}, 'request': {'bill... \n",
390
+ "6074 {'pagination': {'count': 11}, 'request': {'bil... \n",
391
+ "\n",
392
+ " summaries \n",
393
+ "0 {'pagination': {'count': 2}, 'request': {'bill... \\\n",
394
+ "1 {'pagination': {'count': 1}, 'request': {'bill... \n",
395
+ "2 {'pagination': {'count': 3}, 'request': {'bill... \n",
396
+ "3 {'pagination': {'count': 1}, 'request': {'bill... \n",
397
+ "4 {'pagination': {'count': 1}, 'request': {'bill... \n",
398
+ "... ... \n",
399
+ "6070 {'pagination': {'count': 0}, 'request': {'bill... \n",
400
+ "6071 {'pagination': {'count': 1}, 'request': {'bill... \n",
401
+ "6072 {'pagination': {'count': 0}, 'request': {'bill... \n",
402
+ "6073 {'pagination': {'count': 0}, 'request': {'bill... \n",
403
+ "6074 {'pagination': {'count': 1}, 'request': {'bill... \n",
404
+ "\n",
405
+ " text \n",
406
+ "0 {'pagination': {'count': 1}, 'request': {'bill... \\\n",
407
+ "1 {'pagination': {'count': 1}, 'request': {'bill... \n",
408
+ "2 {'pagination': {'count': 3}, 'request': {'bill... \n",
409
+ "3 {'pagination': {'count': 1}, 'request': {'bill... \n",
410
+ "4 {'pagination': {'count': 1}, 'request': {'bill... \n",
411
+ "... ... \n",
412
+ "6070 {'pagination': {'count': 1}, 'request': {'bill... \n",
413
+ "6071 {'pagination': {'count': 1}, 'request': {'bill... \n",
414
+ "6072 {'pagination': {'count': 1}, 'request': {'bill... \n",
415
+ "6073 {'pagination': {'count': 1}, 'request': {'bill... \n",
416
+ "6074 {'pagination': {'count': 2}, 'request': {'bill... \n",
417
+ "\n",
418
+ " titles \n",
419
+ "0 {'pagination': {'count': 2}, 'request': {'bill... \n",
420
+ "1 {'pagination': {'count': 2}, 'request': {'bill... \n",
421
+ "2 {'pagination': {'count': 2}, 'request': {'bill... \n",
422
+ "3 {'pagination': {'count': 2}, 'request': {'bill... \n",
423
+ "4 {'pagination': {'count': 2}, 'request': {'bill... \n",
424
+ "... ... \n",
425
+ "6070 {'pagination': {'count': 2}, 'request': {'bill... \n",
426
+ "6071 {'pagination': {'count': 2}, 'request': {'bill... \n",
427
+ "6072 {'pagination': {'count': 2}, 'request': {'bill... \n",
428
+ "6073 {'pagination': {'count': 2}, 'request': {'bill... \n",
429
+ "6074 {'pagination': {'count': 2}, 'request': {'bill... \n",
430
+ "\n",
431
+ "[6075 rows x 10 columns]"
432
+ ]
433
+ },
434
+ "execution_count": 25,
435
+ "metadata": {},
436
+ "output_type": "execute_result"
437
+ }
438
+ ],
439
+ "source": [
440
+ "rows = []\n",
441
+ "for path in measures['path']:\n",
442
+ " path = Path(path)\n",
443
+ " row = {}\n",
444
+ " for file_name in path.glob('*.json'):\n",
445
+ " column = file_name.name.split('.')[0]\n",
446
+ " # print(column)\n",
447
+ " with file_name.open('r') as fp:\n",
448
+ " dd = json.load(fp)\n",
449
+ " # print(file_name)\n",
450
+ " row[column] = dd\n",
451
+ " # print()\n",
452
+ " rows.append(row)\n",
453
+ " # break\n",
454
+ "records = pd.DataFrame(rows)\n",
455
+ "records"
456
+ ]
457
+ },
458
+ {
459
+ "cell_type": "code",
460
+ "execution_count": 26,
461
+ "id": "1c164166",
462
+ "metadata": {},
463
+ "outputs": [
464
+ {
465
+ "name": "stdout",
466
+ "output_type": "stream",
467
+ "text": [
468
+ "1\n",
469
+ "HCONRES\n",
470
+ "118\n",
471
+ "1\n",
472
+ "Rep. Cole, Tom [R-OK-4]\n",
473
+ "Regarding consent to assemble outside the seat of government.\n"
474
+ ]
475
+ }
476
+ ],
477
+ "source": [
478
+ "print(records['index'][0]['bill']['number'])\n",
479
+ "print(records['index'][0]['bill']['type'])\n",
480
+ "print(records['index'][0]['bill']['congress'])\n",
481
+ "print(records['index'][0]['bill']['sponsors'][0]['fullName'])\n",
482
+ "print(records['index'][0]['bill']['title'])"
483
+ ]
484
+ },
485
+ {
486
+ "cell_type": "code",
487
+ "execution_count": 50,
488
+ "id": "c1fb5bdb",
489
+ "metadata": {},
490
+ "outputs": [
491
+ {
492
+ "data": {
493
+ "text/html": [
494
+ "<div>\n",
495
+ "<style scoped>\n",
496
+ " .dataframe tbody tr th:only-of-type {\n",
497
+ " vertical-align: middle;\n",
498
+ " }\n",
499
+ "\n",
500
+ " .dataframe tbody tr th {\n",
501
+ " vertical-align: top;\n",
502
+ " }\n",
503
+ "\n",
504
+ " .dataframe thead th {\n",
505
+ " text-align: right;\n",
506
+ " }\n",
507
+ "</style>\n",
508
+ "<table border=\"1\" class=\"dataframe\">\n",
509
+ " <thead>\n",
510
+ " <tr style=\"text-align: right;\">\n",
511
+ " <th></th>\n",
512
+ " <th>key</th>\n",
513
+ " <th>title</th>\n",
514
+ " <th>sponsor</th>\n",
515
+ " <th>actions</th>\n",
516
+ " <th>amendments</th>\n",
517
+ " <th>committees</th>\n",
518
+ " <th>cosponsors</th>\n",
519
+ " <th>index</th>\n",
520
+ " <th>relatedbills</th>\n",
521
+ " <th>subjects</th>\n",
522
+ " <th>summaries</th>\n",
523
+ " <th>text</th>\n",
524
+ " <th>titles</th>\n",
525
+ " </tr>\n",
526
+ " </thead>\n",
527
+ " <tbody>\n",
528
+ " <tr>\n",
529
+ " <th>0</th>\n",
530
+ " <td>118HCONRES1</td>\n",
531
+ " <td>Regarding consent to assemble outside the seat...</td>\n",
532
+ " <td>Rep. Cole, Tom [R-OK-4]</td>\n",
533
+ " <td>{'actions': [{'actionDate': '2023-01-23', 'sou...</td>\n",
534
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
535
+ " <td>{'committees': [], 'request': {'billNumber': '...</td>\n",
536
+ " <td>{'cosponsors': [], 'pagination': {'count': 0, ...</td>\n",
537
+ " <td>{'bill': {'actions': {'count': 7, 'url': 'http...</td>\n",
538
+ " <td>{'pagination': {'count': 0}, 'relatedBills': [...</td>\n",
539
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
540
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
541
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
542
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
543
+ " </tr>\n",
544
+ " <tr>\n",
545
+ " <th>1</th>\n",
546
+ " <td>118HCONRES10</td>\n",
547
+ " <td>Expressing the sense of Congress that the Unit...</td>\n",
548
+ " <td>Rep. Tiffany, Thomas P. [R-WI-7]</td>\n",
549
+ " <td>{'actions': [{'actionCode': 'H11100', 'actionD...</td>\n",
550
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
551
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
552
+ " <td>{'cosponsors': [{'bioguideId': 'P000605', 'dis...</td>\n",
553
+ " <td>{'bill': {'actions': {'count': 4, 'url': 'http...</td>\n",
554
+ " <td>{'pagination': {'count': 0}, 'relatedBills': [...</td>\n",
555
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
556
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
557
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
558
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
559
+ " </tr>\n",
560
+ " <tr>\n",
561
+ " <th>2</th>\n",
562
+ " <td>118HCONRES11</td>\n",
563
+ " <td>Providing for a joint session of Congress to r...</td>\n",
564
+ " <td>Rep. Scalise, Steve [R-LA-1]</td>\n",
565
+ " <td>{'actions': [{'actionDate': '2023-02-02', 'sou...</td>\n",
566
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
567
+ " <td>{'committees': [], 'request': {'billNumber': '...</td>\n",
568
+ " <td>{'cosponsors': [], 'pagination': {'count': 0, ...</td>\n",
569
+ " <td>{'bill': {'actions': {'count': 10, 'url': 'htt...</td>\n",
570
+ " <td>{'pagination': {'count': 0}, 'relatedBills': [...</td>\n",
571
+ " <td>{'pagination': {'count': 3}, 'request': {'bill...</td>\n",
572
+ " <td>{'pagination': {'count': 3}, 'request': {'bill...</td>\n",
573
+ " <td>{'pagination': {'count': 3}, 'request': {'bill...</td>\n",
574
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
575
+ " </tr>\n",
576
+ " <tr>\n",
577
+ " <th>3</th>\n",
578
+ " <td>118HCONRES12</td>\n",
579
+ " <td>Expressing the sense of Congress that all dire...</td>\n",
580
+ " <td>Rep. Cammack, Kat [R-FL-3]</td>\n",
581
+ " <td>{'actions': [{'actionCode': 'H11000', 'actionD...</td>\n",
582
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
583
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
584
+ " <td>{'cosponsors': [{'bioguideId': 'K000380', 'dis...</td>\n",
585
+ " <td>{'bill': {'actions': {'count': 5, 'url': 'http...</td>\n",
586
+ " <td>{'pagination': {'count': 0}, 'relatedBills': [...</td>\n",
587
+ " <td>{'pagination': {'count': 6}, 'request': {'bill...</td>\n",
588
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
589
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
590
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
591
+ " </tr>\n",
592
+ " <tr>\n",
593
+ " <th>4</th>\n",
594
+ " <td>118HCONRES13</td>\n",
595
+ " <td>Supporting the Local Radio Freedom Act.</td>\n",
596
+ " <td>Rep. Womack, Steve [R-AR-3]</td>\n",
597
+ " <td>{'actions': [{'actionCode': 'H11100', 'actionD...</td>\n",
598
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
599
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
600
+ " <td>{'cosponsors': [{'bioguideId': 'C001066', 'dis...</td>\n",
601
+ " <td>{'bill': {'actions': {'count': 3, 'url': 'http...</td>\n",
602
+ " <td>{'pagination': {'count': 1}, 'relatedBills': [...</td>\n",
603
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
604
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
605
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
606
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
607
+ " </tr>\n",
608
+ " <tr>\n",
609
+ " <th>...</th>\n",
610
+ " <td>...</td>\n",
611
+ " <td>...</td>\n",
612
+ " <td>...</td>\n",
613
+ " <td>...</td>\n",
614
+ " <td>...</td>\n",
615
+ " <td>...</td>\n",
616
+ " <td>...</td>\n",
617
+ " <td>...</td>\n",
618
+ " <td>...</td>\n",
619
+ " <td>...</td>\n",
620
+ " <td>...</td>\n",
621
+ " <td>...</td>\n",
622
+ " <td>...</td>\n",
623
+ " </tr>\n",
624
+ " <tr>\n",
625
+ " <th>6070</th>\n",
626
+ " <td>118SRES95</td>\n",
627
+ " <td>A resolution honoring the life of Dr. Paul Far...</td>\n",
628
+ " <td>Sen. Brown, Sherrod [D-OH]</td>\n",
629
+ " <td>{'actions': [{'actionDate': '2023-03-07', 'com...</td>\n",
630
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
631
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
632
+ " <td>{'cosponsors': [{'bioguideId': 'W000817', 'fir...</td>\n",
633
+ " <td>{'bill': {'actions': {'count': 2, 'url': 'http...</td>\n",
634
+ " <td>{'pagination': {'count': 1}, 'relatedBills': [...</td>\n",
635
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
636
+ " <td>{'pagination': {'count': 0}, 'request': {'bill...</td>\n",
637
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
638
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
639
+ " </tr>\n",
640
+ " <tr>\n",
641
+ " <th>6071</th>\n",
642
+ " <td>118SRES96</td>\n",
643
+ " <td>A resolution celebrating the extraordinary acc...</td>\n",
644
+ " <td>Sen. Risch, James E. [R-ID]</td>\n",
645
+ " <td>{'actions': [{'actionDate': '2023-03-08', 'com...</td>\n",
646
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
647
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
648
+ " <td>{'cosponsors': [{'bioguideId': 'C000141', 'fir...</td>\n",
649
+ " <td>{'bill': {'actions': {'count': 2, 'url': 'http...</td>\n",
650
+ " <td>{'pagination': {'count': 0}, 'relatedBills': [...</td>\n",
651
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
652
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
653
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
654
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
655
+ " </tr>\n",
656
+ " <tr>\n",
657
+ " <th>6072</th>\n",
658
+ " <td>118SRES97</td>\n",
659
+ " <td>A resolution expressing concern about economic...</td>\n",
660
+ " <td>Sen. Risch, James E. [R-ID]</td>\n",
661
+ " <td>{'actions': [{'actionDate': '2023-03-08', 'com...</td>\n",
662
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
663
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
664
+ " <td>{'cosponsors': [{'bioguideId': 'H000601', 'fir...</td>\n",
665
+ " <td>{'bill': {'actions': {'count': 2, 'url': 'http...</td>\n",
666
+ " <td>{'pagination': {'count': 0}, 'relatedBills': [...</td>\n",
667
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
668
+ " <td>{'pagination': {'count': 0}, 'request': {'bill...</td>\n",
669
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
670
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
671
+ " </tr>\n",
672
+ " <tr>\n",
673
+ " <th>6073</th>\n",
674
+ " <td>118SRES98</td>\n",
675
+ " <td>A resolution declaring March 8, 2023, as \"Nati...</td>\n",
676
+ " <td>Sen. Hickenlooper, John W. [D-CO]</td>\n",
677
+ " <td>{'actions': [{'actionDate': '2023-03-08', 'com...</td>\n",
678
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
679
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
680
+ " <td>{'cosponsors': [{'bioguideId': 'B001267', 'fir...</td>\n",
681
+ " <td>{'bill': {'actions': {'count': 2, 'url': 'http...</td>\n",
682
+ " <td>{'pagination': {'count': 1}, 'relatedBills': [...</td>\n",
683
+ " <td>{'pagination': {'count': 5}, 'request': {'bill...</td>\n",
684
+ " <td>{'pagination': {'count': 0}, 'request': {'bill...</td>\n",
685
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
686
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
687
+ " </tr>\n",
688
+ " <tr>\n",
689
+ " <th>6074</th>\n",
690
+ " <td>118SRES99</td>\n",
691
+ " <td>A resolution supporting the goals of Internati...</td>\n",
692
+ " <td>Sen. Shaheen, Jeanne [D-NH]</td>\n",
693
+ " <td>{'actions': [{'actionDate': '2023-05-10', 'sou...</td>\n",
694
+ " <td>{'amendments': [], 'pagination': {'count': 0},...</td>\n",
695
+ " <td>{'committees': [{'activities': [{'date': '2023...</td>\n",
696
+ " <td>{'cosponsors': [{'bioguideId': 'C001035', 'fir...</td>\n",
697
+ " <td>{'bill': {'actions': {'count': 7, 'url': 'http...</td>\n",
698
+ " <td>{'pagination': {'count': 0}, 'relatedBills': [...</td>\n",
699
+ " <td>{'pagination': {'count': 11}, 'request': {'bil...</td>\n",
700
+ " <td>{'pagination': {'count': 1}, 'request': {'bill...</td>\n",
701
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
702
+ " <td>{'pagination': {'count': 2}, 'request': {'bill...</td>\n",
703
+ " </tr>\n",
704
+ " </tbody>\n",
705
+ "</table>\n",
706
+ "<p>6075 rows × 13 columns</p>\n",
707
+ "</div>"
708
+ ],
709
+ "text/plain": [
710
+ " key title \n",
711
+ "0 118HCONRES1 Regarding consent to assemble outside the seat... \\\n",
712
+ "1 118HCONRES10 Expressing the sense of Congress that the Unit... \n",
713
+ "2 118HCONRES11 Providing for a joint session of Congress to r... \n",
714
+ "3 118HCONRES12 Expressing the sense of Congress that all dire... \n",
715
+ "4 118HCONRES13 Supporting the Local Radio Freedom Act. \n",
716
+ "... ... ... \n",
717
+ "6070 118SRES95 A resolution honoring the life of Dr. Paul Far... \n",
718
+ "6071 118SRES96 A resolution celebrating the extraordinary acc... \n",
719
+ "6072 118SRES97 A resolution expressing concern about economic... \n",
720
+ "6073 118SRES98 A resolution declaring March 8, 2023, as \"Nati... \n",
721
+ "6074 118SRES99 A resolution supporting the goals of Internati... \n",
722
+ "\n",
723
+ " sponsor \n",
724
+ "0 Rep. Cole, Tom [R-OK-4] \\\n",
725
+ "1 Rep. Tiffany, Thomas P. [R-WI-7] \n",
726
+ "2 Rep. Scalise, Steve [R-LA-1] \n",
727
+ "3 Rep. Cammack, Kat [R-FL-3] \n",
728
+ "4 Rep. Womack, Steve [R-AR-3] \n",
729
+ "... ... \n",
730
+ "6070 Sen. Brown, Sherrod [D-OH] \n",
731
+ "6071 Sen. Risch, James E. [R-ID] \n",
732
+ "6072 Sen. Risch, James E. [R-ID] \n",
733
+ "6073 Sen. Hickenlooper, John W. [D-CO] \n",
734
+ "6074 Sen. Shaheen, Jeanne [D-NH] \n",
735
+ "\n",
736
+ " actions \n",
737
+ "0 {'actions': [{'actionDate': '2023-01-23', 'sou... \\\n",
738
+ "1 {'actions': [{'actionCode': 'H11100', 'actionD... \n",
739
+ "2 {'actions': [{'actionDate': '2023-02-02', 'sou... \n",
740
+ "3 {'actions': [{'actionCode': 'H11000', 'actionD... \n",
741
+ "4 {'actions': [{'actionCode': 'H11100', 'actionD... \n",
742
+ "... ... \n",
743
+ "6070 {'actions': [{'actionDate': '2023-03-07', 'com... \n",
744
+ "6071 {'actions': [{'actionDate': '2023-03-08', 'com... \n",
745
+ "6072 {'actions': [{'actionDate': '2023-03-08', 'com... \n",
746
+ "6073 {'actions': [{'actionDate': '2023-03-08', 'com... \n",
747
+ "6074 {'actions': [{'actionDate': '2023-05-10', 'sou... \n",
748
+ "\n",
749
+ " amendments \n",
750
+ "0 {'amendments': [], 'pagination': {'count': 0},... \\\n",
751
+ "1 {'amendments': [], 'pagination': {'count': 0},... \n",
752
+ "2 {'amendments': [], 'pagination': {'count': 0},... \n",
753
+ "3 {'amendments': [], 'pagination': {'count': 0},... \n",
754
+ "4 {'amendments': [], 'pagination': {'count': 0},... \n",
755
+ "... ... \n",
756
+ "6070 {'amendments': [], 'pagination': {'count': 0},... \n",
757
+ "6071 {'amendments': [], 'pagination': {'count': 0},... \n",
758
+ "6072 {'amendments': [], 'pagination': {'count': 0},... \n",
759
+ "6073 {'amendments': [], 'pagination': {'count': 0},... \n",
760
+ "6074 {'amendments': [], 'pagination': {'count': 0},... \n",
761
+ "\n",
762
+ " committees \n",
763
+ "0 {'committees': [], 'request': {'billNumber': '... \\\n",
764
+ "1 {'committees': [{'activities': [{'date': '2023... \n",
765
+ "2 {'committees': [], 'request': {'billNumber': '... \n",
766
+ "3 {'committees': [{'activities': [{'date': '2023... \n",
767
+ "4 {'committees': [{'activities': [{'date': '2023... \n",
768
+ "... ... \n",
769
+ "6070 {'committees': [{'activities': [{'date': '2023... \n",
770
+ "6071 {'committees': [{'activities': [{'date': '2023... \n",
771
+ "6072 {'committees': [{'activities': [{'date': '2023... \n",
772
+ "6073 {'committees': [{'activities': [{'date': '2023... \n",
773
+ "6074 {'committees': [{'activities': [{'date': '2023... \n",
774
+ "\n",
775
+ " cosponsors \n",
776
+ "0 {'cosponsors': [], 'pagination': {'count': 0, ... \\\n",
777
+ "1 {'cosponsors': [{'bioguideId': 'P000605', 'dis... \n",
778
+ "2 {'cosponsors': [], 'pagination': {'count': 0, ... \n",
779
+ "3 {'cosponsors': [{'bioguideId': 'K000380', 'dis... \n",
780
+ "4 {'cosponsors': [{'bioguideId': 'C001066', 'dis... \n",
781
+ "... ... \n",
782
+ "6070 {'cosponsors': [{'bioguideId': 'W000817', 'fir... \n",
783
+ "6071 {'cosponsors': [{'bioguideId': 'C000141', 'fir... \n",
784
+ "6072 {'cosponsors': [{'bioguideId': 'H000601', 'fir... \n",
785
+ "6073 {'cosponsors': [{'bioguideId': 'B001267', 'fir... \n",
786
+ "6074 {'cosponsors': [{'bioguideId': 'C001035', 'fir... \n",
787
+ "\n",
788
+ " index \n",
789
+ "0 {'bill': {'actions': {'count': 7, 'url': 'http... \\\n",
790
+ "1 {'bill': {'actions': {'count': 4, 'url': 'http... \n",
791
+ "2 {'bill': {'actions': {'count': 10, 'url': 'htt... \n",
792
+ "3 {'bill': {'actions': {'count': 5, 'url': 'http... \n",
793
+ "4 {'bill': {'actions': {'count': 3, 'url': 'http... \n",
794
+ "... ... \n",
795
+ "6070 {'bill': {'actions': {'count': 2, 'url': 'http... \n",
796
+ "6071 {'bill': {'actions': {'count': 2, 'url': 'http... \n",
797
+ "6072 {'bill': {'actions': {'count': 2, 'url': 'http... \n",
798
+ "6073 {'bill': {'actions': {'count': 2, 'url': 'http... \n",
799
+ "6074 {'bill': {'actions': {'count': 7, 'url': 'http... \n",
800
+ "\n",
801
+ " relatedbills \n",
802
+ "0 {'pagination': {'count': 0}, 'relatedBills': [... \\\n",
803
+ "1 {'pagination': {'count': 0}, 'relatedBills': [... \n",
804
+ "2 {'pagination': {'count': 0}, 'relatedBills': [... \n",
805
+ "3 {'pagination': {'count': 0}, 'relatedBills': [... \n",
806
+ "4 {'pagination': {'count': 1}, 'relatedBills': [... \n",
807
+ "... ... \n",
808
+ "6070 {'pagination': {'count': 1}, 'relatedBills': [... \n",
809
+ "6071 {'pagination': {'count': 0}, 'relatedBills': [... \n",
810
+ "6072 {'pagination': {'count': 0}, 'relatedBills': [... \n",
811
+ "6073 {'pagination': {'count': 1}, 'relatedBills': [... \n",
812
+ "6074 {'pagination': {'count': 0}, 'relatedBills': [... \n",
813
+ "\n",
814
+ " subjects \n",
815
+ "0 {'pagination': {'count': 2}, 'request': {'bill... \\\n",
816
+ "1 {'pagination': {'count': 1}, 'request': {'bill... \n",
817
+ "2 {'pagination': {'count': 3}, 'request': {'bill... \n",
818
+ "3 {'pagination': {'count': 6}, 'request': {'bill... \n",
819
+ "4 {'pagination': {'count': 2}, 'request': {'bill... \n",
820
+ "... ... \n",
821
+ "6070 {'pagination': {'count': 1}, 'request': {'bill... \n",
822
+ "6071 {'pagination': {'count': 1}, 'request': {'bill... \n",
823
+ "6072 {'pagination': {'count': 1}, 'request': {'bill... \n",
824
+ "6073 {'pagination': {'count': 5}, 'request': {'bill... \n",
825
+ "6074 {'pagination': {'count': 11}, 'request': {'bil... \n",
826
+ "\n",
827
+ " summaries \n",
828
+ "0 {'pagination': {'count': 2}, 'request': {'bill... \\\n",
829
+ "1 {'pagination': {'count': 1}, 'request': {'bill... \n",
830
+ "2 {'pagination': {'count': 3}, 'request': {'bill... \n",
831
+ "3 {'pagination': {'count': 1}, 'request': {'bill... \n",
832
+ "4 {'pagination': {'count': 1}, 'request': {'bill... \n",
833
+ "... ... \n",
834
+ "6070 {'pagination': {'count': 0}, 'request': {'bill... \n",
835
+ "6071 {'pagination': {'count': 1}, 'request': {'bill... \n",
836
+ "6072 {'pagination': {'count': 0}, 'request': {'bill... \n",
837
+ "6073 {'pagination': {'count': 0}, 'request': {'bill... \n",
838
+ "6074 {'pagination': {'count': 1}, 'request': {'bill... \n",
839
+ "\n",
840
+ " text \n",
841
+ "0 {'pagination': {'count': 1}, 'request': {'bill... \\\n",
842
+ "1 {'pagination': {'count': 1}, 'request': {'bill... \n",
843
+ "2 {'pagination': {'count': 3}, 'request': {'bill... \n",
844
+ "3 {'pagination': {'count': 1}, 'request': {'bill... \n",
845
+ "4 {'pagination': {'count': 1}, 'request': {'bill... \n",
846
+ "... ... \n",
847
+ "6070 {'pagination': {'count': 1}, 'request': {'bill... \n",
848
+ "6071 {'pagination': {'count': 1}, 'request': {'bill... \n",
849
+ "6072 {'pagination': {'count': 1}, 'request': {'bill... \n",
850
+ "6073 {'pagination': {'count': 1}, 'request': {'bill... \n",
851
+ "6074 {'pagination': {'count': 2}, 'request': {'bill... \n",
852
+ "\n",
853
+ " titles \n",
854
+ "0 {'pagination': {'count': 2}, 'request': {'bill... \n",
855
+ "1 {'pagination': {'count': 2}, 'request': {'bill... \n",
856
+ "2 {'pagination': {'count': 2}, 'request': {'bill... \n",
857
+ "3 {'pagination': {'count': 2}, 'request': {'bill... \n",
858
+ "4 {'pagination': {'count': 2}, 'request': {'bill... \n",
859
+ "... ... \n",
860
+ "6070 {'pagination': {'count': 2}, 'request': {'bill... \n",
861
+ "6071 {'pagination': {'count': 2}, 'request': {'bill... \n",
862
+ "6072 {'pagination': {'count': 2}, 'request': {'bill... \n",
863
+ "6073 {'pagination': {'count': 2}, 'request': {'bill... \n",
864
+ "6074 {'pagination': {'count': 2}, 'request': {'bill... \n",
865
+ "\n",
866
+ "[6075 rows x 13 columns]"
867
+ ]
868
+ },
869
+ "execution_count": 50,
870
+ "metadata": {},
871
+ "output_type": "execute_result"
872
+ }
873
+ ],
874
+ "source": [
875
+ "records['key'] = records.apply(\n",
876
+ " lambda x:'%s%s%s' % (x['index']['bill']['congress'], x['index']['bill']['type'], x['index']['bill']['number']),\n",
877
+ " axis=1\n",
878
+ ")\n",
879
+ "records['sponsor'] = records.apply(\n",
880
+ " lambda x: x['index']['bill']['sponsors'][0]['fullName'],\n",
881
+ " axis=1\n",
882
+ ")\n",
883
+ "records['title'] = records.apply(\n",
884
+ " lambda x: x['index']['bill']['title'],\n",
885
+ " axis=1\n",
886
+ ")\n",
887
+ "\n",
888
+ "cols = [\n",
889
+ " 'key',\n",
890
+ " 'title',\n",
891
+ " 'sponsor',\n",
892
+ " 'actions',\n",
893
+ " 'amendments',\n",
894
+ " 'committees',\n",
895
+ " 'cosponsors',\n",
896
+ " 'index',\n",
897
+ " 'relatedbills',\n",
898
+ " 'subjects',\n",
899
+ " 'summaries',\n",
900
+ " 'text',\n",
901
+ " 'titles',\n",
902
+ "]\n",
903
+ "\n",
904
+ "records = records[cols]\n",
905
+ "records"
906
+ ]
907
+ },
908
+ {
909
+ "cell_type": "code",
910
+ "execution_count": 51,
911
+ "id": "aafc8b27",
912
+ "metadata": {},
913
+ "outputs": [],
914
+ "source": [
915
+ "records.to_parquet('records.parquet')"
916
+ ]
917
+ },
918
+ {
919
+ "cell_type": "code",
920
+ "execution_count": 52,
921
+ "id": "d67e5da3",
922
+ "metadata": {},
923
+ "outputs": [
924
+ {
925
+ "name": "stdout",
926
+ "output_type": "stream",
927
+ "text": [
928
+ "Downloading and preparing dataset parquet/default to /home/calliope/.cache/huggingface/datasets/parquet/default-de71cc2901977da2/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec...\n"
929
+ ]
930
+ },
931
+ {
932
+ "data": {
933
+ "application/vnd.jupyter.widget-view+json": {
934
+ "model_id": "4722f3b509d944fcb01c7c9788269e7b",
935
+ "version_major": 2,
936
+ "version_minor": 0
937
+ },
938
+ "text/plain": [
939
+ "Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]"
940
+ ]
941
+ },
942
+ "metadata": {},
943
+ "output_type": "display_data"
944
+ },
945
+ {
946
+ "data": {
947
+ "application/vnd.jupyter.widget-view+json": {
948
+ "model_id": "05bb1657ff0146fa9e52e43d857a4423",
949
+ "version_major": 2,
950
+ "version_minor": 0
951
+ },
952
+ "text/plain": [
953
+ "Extracting data files: 0%| | 0/1 [00:00<?, ?it/s]"
954
+ ]
955
+ },
956
+ "metadata": {},
957
+ "output_type": "display_data"
958
+ },
959
+ {
960
+ "data": {
961
+ "application/vnd.jupyter.widget-view+json": {
962
+ "model_id": "",
963
+ "version_major": 2,
964
+ "version_minor": 0
965
+ },
966
+ "text/plain": [
967
+ "Generating train split: 0 examples [00:00, ? examples/s]"
968
+ ]
969
+ },
970
+ "metadata": {},
971
+ "output_type": "display_data"
972
+ },
973
+ {
974
+ "name": "stdout",
975
+ "output_type": "stream",
976
+ "text": [
977
+ "Dataset parquet downloaded and prepared to /home/calliope/.cache/huggingface/datasets/parquet/default-de71cc2901977da2/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec. Subsequent calls will reuse this data.\n"
978
+ ]
979
+ },
980
+ {
981
+ "data": {
982
+ "application/vnd.jupyter.widget-view+json": {
983
+ "model_id": "e0356c18e6e646c2a7edfbea673434fd",
984
+ "version_major": 2,
985
+ "version_minor": 0
986
+ },
987
+ "text/plain": [
988
+ " 0%| | 0/1 [00:00<?, ?it/s]"
989
+ ]
990
+ },
991
+ "metadata": {},
992
+ "output_type": "display_data"
993
+ }
994
+ ],
995
+ "source": [
996
+ "dataset = load_dataset('parquet', data_files={ 'train': 'records.parquet' })"
997
+ ]
998
+ },
999
+ {
1000
+ "cell_type": "code",
1001
+ "execution_count": 53,
1002
+ "id": "1a982cff",
1003
+ "metadata": {},
1004
+ "outputs": [
1005
+ {
1006
+ "data": {
1007
+ "text/plain": [
1008
+ "DatasetDict({\n",
1009
+ " train: Dataset({\n",
1010
+ " features: ['key', 'title', 'sponsor', 'actions', 'amendments', 'committees', 'cosponsors', 'index', 'relatedbills', 'subjects', 'summaries', 'text', 'titles'],\n",
1011
+ " num_rows: 6075\n",
1012
+ " })\n",
1013
+ "})"
1014
+ ]
1015
+ },
1016
+ "execution_count": 53,
1017
+ "metadata": {},
1018
+ "output_type": "execute_result"
1019
+ }
1020
+ ],
1021
+ "source": [
1022
+ "dataset"
1023
+ ]
1024
+ },
1025
+ {
1026
+ "cell_type": "code",
1027
+ "execution_count": 55,
1028
+ "id": "86830422",
1029
+ "metadata": {},
1030
+ "outputs": [],
1031
+ "source": [
1032
+ "dataset.push_to_hub?"
1033
+ ]
1034
+ },
1035
+ {
1036
+ "cell_type": "code",
1037
+ "execution_count": 40,
1038
+ "id": "59f22d90",
1039
+ "metadata": {},
1040
+ "outputs": [
1041
+ {
1042
+ "data": {
1043
+ "text/plain": [
1044
+ "'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'"
1045
+ ]
1046
+ },
1047
+ "execution_count": 40,
1048
+ "metadata": {},
1049
+ "output_type": "execute_result"
1050
+ }
1051
+ ],
1052
+ "source": [
1053
+ "with open('.call', 'r') as blob:\n",
1054
+ " calls = blob.readlines()\n",
1055
+ " call = dict(line.strip().split(\"=\") for line in calls)"
1056
+ ]
1057
+ },
1058
+ {
1059
+ "cell_type": "code",
1060
+ "execution_count": 54,
1061
+ "id": "71d10ec3",
1062
+ "metadata": {},
1063
+ "outputs": [
1064
+ {
1065
+ "name": "stderr",
1066
+ "output_type": "stream",
1067
+ "text": [
1068
+ "Pushing split train to the Hub.\n"
1069
+ ]
1070
+ },
1071
+ {
1072
+ "data": {
1073
+ "application/vnd.jupyter.widget-view+json": {
1074
+ "model_id": "9428de1975404479a6aa65dce074f933",
1075
+ "version_major": 2,
1076
+ "version_minor": 0
1077
+ },
1078
+ "text/plain": [
1079
+ "Pushing dataset shards to the dataset hub: 0%| | 0/1 [00:00<?, ?it/s]"
1080
+ ]
1081
+ },
1082
+ "metadata": {},
1083
+ "output_type": "display_data"
1084
+ },
1085
+ {
1086
+ "data": {
1087
+ "application/vnd.jupyter.widget-view+json": {
1088
+ "model_id": "09160d0897fe4aa791aec75a9314753d",
1089
+ "version_major": 2,
1090
+ "version_minor": 0
1091
+ },
1092
+ "text/plain": [
1093
+ "Creating parquet from Arrow format: 0%| | 0/7 [00:00<?, ?ba/s]"
1094
+ ]
1095
+ },
1096
+ "metadata": {},
1097
+ "output_type": "display_data"
1098
+ },
1099
+ {
1100
+ "data": {
1101
+ "application/vnd.jupyter.widget-view+json": {
1102
+ "model_id": "4ab3a580970c4d0081a63a024f373bc7",
1103
+ "version_major": 2,
1104
+ "version_minor": 0
1105
+ },
1106
+ "text/plain": [
1107
+ "Deleting unused files from dataset repository: 0%| | 0/1 [00:00<?, ?it/s]"
1108
+ ]
1109
+ },
1110
+ "metadata": {},
1111
+ "output_type": "display_data"
1112
+ },
1113
+ {
1114
+ "data": {
1115
+ "application/vnd.jupyter.widget-view+json": {
1116
+ "model_id": "976973018c65419782ab1a13bfe49fd1",
1117
+ "version_major": 2,
1118
+ "version_minor": 0
1119
+ },
1120
+ "text/plain": [
1121
+ "Downloading metadata: 0%| | 0.00/11.8k [00:00<?, ?B/s]"
1122
+ ]
1123
+ },
1124
+ "metadata": {},
1125
+ "output_type": "display_data"
1126
+ }
1127
+ ],
1128
+ "source": [
1129
+ "dataset.push_to_hub('c4lliope/us-congress', token = call['huggingface.key'])"
1130
+ ]
1131
+ },
1132
+ {
1133
+ "cell_type": "code",
1134
+ "execution_count": null,
1135
+ "id": "9a26f564",
1136
+ "metadata": {},
1137
+ "outputs": [],
1138
+ "source": []
1139
+ }
1140
+ ],
1141
+ "metadata": {
1142
+ "kernelspec": {
1143
+ "display_name": "Python 3 (ipykernel)",
1144
+ "language": "python",
1145
+ "name": "python3"
1146
+ },
1147
+ "language_info": {
1148
+ "codemirror_mode": {
1149
+ "name": "ipython",
1150
+ "version": 3
1151
+ },
1152
+ "file_extension": ".py",
1153
+ "mimetype": "text/x-python",
1154
+ "name": "python",
1155
+ "nbconvert_exporter": "python",
1156
+ "pygments_lexer": "ipython3",
1157
+ "version": "3.11.3"
1158
+ }
1159
+ },
1160
+ "nbformat": 4,
1161
+ "nbformat_minor": 5
1162
+ }