pytae 2.2.4__tar.gz → 2.2.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {pytae-2.2.4 → pytae-2.2.5}/.ipynb_checkpoints/pyproject-checkpoint.toml +1 -1
  2. {pytae-2.2.4 → pytae-2.2.5}/PKG-INFO +1 -1
  3. {pytae-2.2.4 → pytae-2.2.5}/pyproject.toml +1 -1
  4. {pytae-2.2.4 → pytae-2.2.5}/src/.ipynb_checkpoints/agg_df-checkpoint.ipynb +9 -9
  5. {pytae-2.2.4 → pytae-2.2.5}/src/.ipynb_checkpoints/get_data-checkpoint.ipynb +149 -19
  6. {pytae-2.2.4 → pytae-2.2.5}/src/.ipynb_checkpoints/other_utilities-checkpoint.ipynb +8 -8
  7. {pytae-2.2.4 → pytae-2.2.5}/src/.ipynb_checkpoints/shape-checkpoint.ipynb +13 -13
  8. {pytae-2.2.4 → pytae-2.2.5}/src/agg_df.ipynb +9 -9
  9. {pytae-2.2.4 → pytae-2.2.5}/src/get_data.ipynb +149 -19
  10. {pytae-2.2.4 → pytae-2.2.5}/src/other_utilities.ipynb +8 -8
  11. {pytae-2.2.4 → pytae-2.2.5}/src/pytae/.ipynb_checkpoints/get_data-checkpoint.py +2 -0
  12. {pytae-2.2.4 → pytae-2.2.5}/src/pytae/.ipynb_checkpoints/shape-checkpoint.py +8 -7
  13. {pytae-2.2.4 → pytae-2.2.5}/src/pytae/get_data.py +2 -0
  14. {pytae-2.2.4 → pytae-2.2.5}/src/pytae/shape.py +8 -7
  15. {pytae-2.2.4 → pytae-2.2.5}/src/shape.ipynb +13 -13
  16. {pytae-2.2.4 → pytae-2.2.5}/.github/workflows/publish-to-test-pypi.yml +0 -0
  17. {pytae-2.2.4 → pytae-2.2.5}/.gitignore +0 -0
  18. {pytae-2.2.4 → pytae-2.2.5}/.ipynb_checkpoints/LICENSE-checkpoint +0 -0
  19. {pytae-2.2.4 → pytae-2.2.5}/.ipynb_checkpoints/README-checkpoint.md +0 -0
  20. {pytae-2.2.4 → pytae-2.2.5}/.ipynb_checkpoints/requirements-checkpoint.txt +0 -0
  21. {pytae-2.2.4 → pytae-2.2.5}/LICENSE +0 -0
  22. {pytae-2.2.4 → pytae-2.2.5}/README.md +0 -0
  23. {pytae-2.2.4 → pytae-2.2.5}/requirements.txt +0 -0
  24. {pytae-2.2.4 → pytae-2.2.5}/src/pytae/.ipynb_checkpoints/__init__-checkpoint.py +0 -0
  25. {pytae-2.2.4 → pytae-2.2.5}/src/pytae/.ipynb_checkpoints/agg_df-checkpoint.py +0 -0
  26. {pytae-2.2.4 → pytae-2.2.5}/src/pytae/.ipynb_checkpoints/other_utilities-checkpoint.py +0 -0
  27. {pytae-2.2.4 → pytae-2.2.5}/src/pytae/__init__.py +0 -0
  28. {pytae-2.2.4 → pytae-2.2.5}/src/pytae/agg_df.py +0 -0
  29. {pytae-2.2.4 → pytae-2.2.5}/src/pytae/other_utilities.py +0 -0
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pytae"
7
- version = "2.2.4"
7
+ version = "2.2.5"
8
8
  authors = [
9
9
  { name="Madhukar Kumar Jha", email="madhukar.k.jha@gmail.com" },
10
10
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pytae
3
- Version: 2.2.4
3
+ Version: 2.2.5
4
4
  Dynamic: Requires-Dist
5
5
  Summary: A package to enhance common day to day tasks in the life of a data scientist
6
6
  Project-URL: Homepage, https://github.com/maddytae/pytae
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pytae"
7
- version = "2.2.4"
7
+ version = "2.2.5"
8
8
  authors = [
9
9
  { name="Madhukar Kumar Jha", email="madhukar.k.jha@gmail.com" },
10
10
  ]
@@ -2,7 +2,7 @@
2
2
  "cells": [
3
3
  {
4
4
  "cell_type": "code",
5
- "execution_count": 17,
5
+ "execution_count": 29,
6
6
  "id": "e1e35300-a92f-47dd-b448-83861e79eedf",
7
7
  "metadata": {},
8
8
  "outputs": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  {
17
17
  "cell_type": "code",
18
- "execution_count": 18,
18
+ "execution_count": 30,
19
19
  "id": "c3f73408-8dc7-4ea5-899b-e3b23a692cd8",
20
20
  "metadata": {},
21
21
  "outputs": [],
@@ -27,7 +27,7 @@
27
27
  },
28
28
  {
29
29
  "cell_type": "code",
30
- "execution_count": 19,
30
+ "execution_count": 31,
31
31
  "id": "db20c1c7-c11f-431d-ae9c-d0c424f0d423",
32
32
  "metadata": {},
33
33
  "outputs": [
@@ -139,7 +139,7 @@
139
139
  "6 f 45 20 22.5 25 2"
140
140
  ]
141
141
  },
142
- "execution_count": 19,
142
+ "execution_count": 31,
143
143
  "metadata": {},
144
144
  "output_type": "execute_result"
145
145
  }
@@ -150,7 +150,7 @@
150
150
  },
151
151
  {
152
152
  "cell_type": "code",
153
- "execution_count": 20,
153
+ "execution_count": 32,
154
154
  "id": "66cb16ac-30b8-491e-94b4-0a2065d1e29b",
155
155
  "metadata": {},
156
156
  "outputs": [
@@ -230,7 +230,7 @@
230
230
  "6 f 45"
231
231
  ]
232
232
  },
233
- "execution_count": 20,
233
+ "execution_count": 32,
234
234
  "metadata": {},
235
235
  "output_type": "execute_result"
236
236
  }
@@ -243,7 +243,7 @@
243
243
  },
244
244
  {
245
245
  "cell_type": "code",
246
- "execution_count": 21,
246
+ "execution_count": 33,
247
247
  "id": "cbf32f4b-5f41-4ea7-bfa4-9f884d714f31",
248
248
  "metadata": {},
249
249
  "outputs": [
@@ -419,7 +419,7 @@
419
419
  "9 13514.0 334575.0 "
420
420
  ]
421
421
  },
422
- "execution_count": 21,
422
+ "execution_count": 33,
423
423
  "metadata": {},
424
424
  "output_type": "execute_result"
425
425
  }
@@ -431,7 +431,7 @@
431
431
  {
432
432
  "cell_type": "code",
433
433
  "execution_count": null,
434
- "id": "773cca3c-564a-4c3a-bfcf-12b5ddfa6683",
434
+ "id": "8a7d5322-31ef-4e03-abfd-4220b12c2520",
435
435
  "metadata": {},
436
436
  "outputs": [],
437
437
  "source": []
@@ -2,7 +2,7 @@
2
2
  "cells": [
3
3
  {
4
4
  "cell_type": "code",
5
- "execution_count": 9,
5
+ "execution_count": 11,
6
6
  "id": "0fe64a26-2fb9-4272-b389-768653879781",
7
7
  "metadata": {},
8
8
  "outputs": [],
@@ -18,7 +18,7 @@
18
18
  },
19
19
  {
20
20
  "cell_type": "code",
21
- "execution_count": 10,
21
+ "execution_count": 12,
22
22
  "id": "71ff2554-e610-4592-a019-c3bc2b0c536d",
23
23
  "metadata": {},
24
24
  "outputs": [
@@ -104,7 +104,7 @@
104
104
  "4 Dream NaN Adelie 2975.0 37.5"
105
105
  ]
106
106
  },
107
- "execution_count": 10,
107
+ "execution_count": 12,
108
108
  "metadata": {},
109
109
  "output_type": "execute_result"
110
110
  }
@@ -117,7 +117,7 @@
117
117
  },
118
118
  {
119
119
  "cell_type": "code",
120
- "execution_count": 11,
120
+ "execution_count": 13,
121
121
  "id": "9ed6f23b-f588-4651-9db4-3cfb56b37a9b",
122
122
  "metadata": {},
123
123
  "outputs": [
@@ -142,8 +142,8 @@
142
142
  " <thead>\n",
143
143
  " <tr style=\"text-align: right;\">\n",
144
144
  " <th></th>\n",
145
- " <th>island</th>\n",
146
145
  " <th>sex</th>\n",
146
+ " <th>island</th>\n",
147
147
  " <th>species</th>\n",
148
148
  " <th>body_mass_g</th>\n",
149
149
  " </tr>\n",
@@ -151,36 +151,36 @@
151
151
  " <tbody>\n",
152
152
  " <tr>\n",
153
153
  " <th>0</th>\n",
154
- " <td>Biscoe</td>\n",
155
154
  " <td>Male</td>\n",
155
+ " <td>Biscoe</td>\n",
156
156
  " <td>Adelie</td>\n",
157
157
  " <td>89100.0</td>\n",
158
158
  " </tr>\n",
159
159
  " <tr>\n",
160
160
  " <th>1</th>\n",
161
- " <td>Biscoe</td>\n",
162
161
  " <td>Male</td>\n",
162
+ " <td>Biscoe</td>\n",
163
163
  " <td>Gentoo</td>\n",
164
164
  " <td>334575.0</td>\n",
165
165
  " </tr>\n",
166
166
  " <tr>\n",
167
167
  " <th>2</th>\n",
168
- " <td>Dream</td>\n",
169
168
  " <td>Male</td>\n",
169
+ " <td>Dream</td>\n",
170
170
  " <td>Adelie</td>\n",
171
171
  " <td>113275.0</td>\n",
172
172
  " </tr>\n",
173
173
  " <tr>\n",
174
174
  " <th>3</th>\n",
175
- " <td>Dream</td>\n",
176
175
  " <td>Male</td>\n",
176
+ " <td>Dream</td>\n",
177
177
  " <td>Chinstrap</td>\n",
178
178
  " <td>133925.0</td>\n",
179
179
  " </tr>\n",
180
180
  " <tr>\n",
181
181
  " <th>4</th>\n",
182
- " <td>Torgersen</td>\n",
183
182
  " <td>Male</td>\n",
183
+ " <td>Torgersen</td>\n",
184
184
  " <td>Adelie</td>\n",
185
185
  " <td>92800.0</td>\n",
186
186
  " </tr>\n",
@@ -189,15 +189,15 @@
189
189
  "</div>"
190
190
  ],
191
191
  "text/plain": [
192
- " island sex species body_mass_g\n",
193
- "0 Biscoe Male Adelie 89100.0\n",
194
- "1 Biscoe Male Gentoo 334575.0\n",
195
- "2 Dream Male Adelie 113275.0\n",
196
- "3 Dream Male Chinstrap 133925.0\n",
197
- "4 Torgersen Male Adelie 92800.0"
192
+ " sex island species body_mass_g\n",
193
+ "0 Male Biscoe Adelie 89100.0\n",
194
+ "1 Male Biscoe Gentoo 334575.0\n",
195
+ "2 Male Dream Adelie 113275.0\n",
196
+ "3 Male Dream Chinstrap 133925.0\n",
197
+ "4 Male Torgersen Adelie 92800.0"
198
198
  ]
199
199
  },
200
- "execution_count": 11,
200
+ "execution_count": 13,
201
201
  "metadata": {},
202
202
  "output_type": "execute_result"
203
203
  }
@@ -205,14 +205,144 @@
205
205
  "source": [
206
206
  "penguins.get_data(value='body_mass_g',sex=['Male'],\n",
207
207
  " default_cols=['island','sex','species'],\n",
208
- " agg_func='sum')"
208
+ " aggfunc='sum')"
209
209
  ]
210
210
  },
211
211
  {
212
212
  "cell_type": "code",
213
- "execution_count": null,
213
+ "execution_count": 14,
214
214
  "id": "2e9408f6-09bf-4893-8c21-87c791dbe65e",
215
215
  "metadata": {},
216
+ "outputs": [
217
+ {
218
+ "data": {
219
+ "text/html": [
220
+ "<div>\n",
221
+ "<style scoped>\n",
222
+ " .dataframe tbody tr th:only-of-type {\n",
223
+ " vertical-align: middle;\n",
224
+ " }\n",
225
+ "\n",
226
+ " .dataframe tbody tr th {\n",
227
+ " vertical-align: top;\n",
228
+ " }\n",
229
+ "\n",
230
+ " .dataframe thead th {\n",
231
+ " text-align: right;\n",
232
+ " }\n",
233
+ "</style>\n",
234
+ "<table border=\"1\" class=\"dataframe\">\n",
235
+ " <thead>\n",
236
+ " <tr style=\"text-align: right;\">\n",
237
+ " <th></th>\n",
238
+ " <th>species</th>\n",
239
+ " <th>body_mass_g</th>\n",
240
+ " </tr>\n",
241
+ " </thead>\n",
242
+ " <tbody>\n",
243
+ " <tr>\n",
244
+ " <th>0</th>\n",
245
+ " <td>Adelie</td>\n",
246
+ " <td>3700.662252</td>\n",
247
+ " </tr>\n",
248
+ " <tr>\n",
249
+ " <th>1</th>\n",
250
+ " <td>Chinstrap</td>\n",
251
+ " <td>3733.088235</td>\n",
252
+ " </tr>\n",
253
+ " <tr>\n",
254
+ " <th>2</th>\n",
255
+ " <td>Gentoo</td>\n",
256
+ " <td>5076.016260</td>\n",
257
+ " </tr>\n",
258
+ " </tbody>\n",
259
+ "</table>\n",
260
+ "</div>"
261
+ ],
262
+ "text/plain": [
263
+ " species body_mass_g\n",
264
+ "0 Adelie 3700.662252\n",
265
+ "1 Chinstrap 3733.088235\n",
266
+ "2 Gentoo 5076.016260"
267
+ ]
268
+ },
269
+ "execution_count": 14,
270
+ "metadata": {},
271
+ "output_type": "execute_result"
272
+ }
273
+ ],
274
+ "source": [
275
+ "penguins.get_data(value=['body_mass_g'],\n",
276
+ " default_cols=['species'],\n",
277
+ " aggfunc='mean')"
278
+ ]
279
+ },
280
+ {
281
+ "cell_type": "code",
282
+ "execution_count": 15,
283
+ "id": "6d82acc4-bbfb-4bd0-89f5-74571341cc84",
284
+ "metadata": {},
285
+ "outputs": [
286
+ {
287
+ "data": {
288
+ "text/html": [
289
+ "<div>\n",
290
+ "<style scoped>\n",
291
+ " .dataframe tbody tr th:only-of-type {\n",
292
+ " vertical-align: middle;\n",
293
+ " }\n",
294
+ "\n",
295
+ " .dataframe tbody tr th {\n",
296
+ " vertical-align: top;\n",
297
+ " }\n",
298
+ "\n",
299
+ " .dataframe thead th {\n",
300
+ " text-align: right;\n",
301
+ " }\n",
302
+ "</style>\n",
303
+ "<table border=\"1\" class=\"dataframe\">\n",
304
+ " <thead>\n",
305
+ " <tr style=\"text-align: right;\">\n",
306
+ " <th></th>\n",
307
+ " <th>index</th>\n",
308
+ " <th>Adelie</th>\n",
309
+ " <th>Chinstrap</th>\n",
310
+ " <th>Gentoo</th>\n",
311
+ " </tr>\n",
312
+ " </thead>\n",
313
+ " <tbody>\n",
314
+ " <tr>\n",
315
+ " <th>0</th>\n",
316
+ " <td>body_mass_g</td>\n",
317
+ " <td>3700.662252</td>\n",
318
+ " <td>3733.088235</td>\n",
319
+ " <td>5076.01626</td>\n",
320
+ " </tr>\n",
321
+ " </tbody>\n",
322
+ "</table>\n",
323
+ "</div>"
324
+ ],
325
+ "text/plain": [
326
+ " index Adelie Chinstrap Gentoo\n",
327
+ "0 body_mass_g 3700.662252 3733.088235 5076.01626"
328
+ ]
329
+ },
330
+ "execution_count": 15,
331
+ "metadata": {},
332
+ "output_type": "execute_result"
333
+ }
334
+ ],
335
+ "source": [
336
+ "penguins.get_data(value=['body_mass_g'],\n",
337
+ " default_cols=['species'],\n",
338
+ " aggfunc='mean').wide(col='species',value='body_mass_g')"
339
+ ]
340
+ },
341
+ {
342
+ "cell_type": "code",
343
+ "execution_count": null,
344
+ "id": "f698a627-4754-4ac1-ba0a-e6f7271214e7",
345
+ "metadata": {},
216
346
  "outputs": [],
217
347
  "source": []
218
348
  }
@@ -2,7 +2,7 @@
2
2
  "cells": [
3
3
  {
4
4
  "cell_type": "code",
5
- "execution_count": 6,
5
+ "execution_count": 16,
6
6
  "id": "af0e75c1-7748-44e7-974e-34112d92d813",
7
7
  "metadata": {},
8
8
  "outputs": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  {
17
17
  "cell_type": "code",
18
- "execution_count": 7,
18
+ "execution_count": 17,
19
19
  "id": "e42e01b5-4b00-4f95-acec-274deda67a3c",
20
20
  "metadata": {},
21
21
  "outputs": [
@@ -31,7 +31,7 @@
31
31
  " 'species']"
32
32
  ]
33
33
  },
34
- "execution_count": 7,
34
+ "execution_count": 17,
35
35
  "metadata": {},
36
36
  "output_type": "execute_result"
37
37
  }
@@ -43,7 +43,7 @@
43
43
  },
44
44
  {
45
45
  "cell_type": "code",
46
- "execution_count": 8,
46
+ "execution_count": 18,
47
47
  "id": "e7136bed-d2e1-48c5-a337-8e31fc020a98",
48
48
  "metadata": {},
49
49
  "outputs": [
@@ -154,7 +154,7 @@
154
154
  "4 3450.0 Female 24 "
155
155
  ]
156
156
  },
157
- "execution_count": 8,
157
+ "execution_count": 18,
158
158
  "metadata": {},
159
159
  "output_type": "execute_result"
160
160
  }
@@ -170,7 +170,7 @@
170
170
  },
171
171
  {
172
172
  "cell_type": "code",
173
- "execution_count": 9,
173
+ "execution_count": 19,
174
174
  "id": "87e3dd20-d5e1-4219-8aee-e842a3d52194",
175
175
  "metadata": {},
176
176
  "outputs": [
@@ -275,7 +275,7 @@
275
275
  "4 3450.0 Female "
276
276
  ]
277
277
  },
278
- "execution_count": 9,
278
+ "execution_count": 19,
279
279
  "metadata": {},
280
280
  "output_type": "execute_result"
281
281
  }
@@ -292,7 +292,7 @@
292
292
  },
293
293
  {
294
294
  "cell_type": "code",
295
- "execution_count": 10,
295
+ "execution_count": 20,
296
296
  "id": "b17a9574-35ff-4fe2-b40f-054a0b5e5003",
297
297
  "metadata": {},
298
298
  "outputs": [],
@@ -2,7 +2,7 @@
2
2
  "cells": [
3
3
  {
4
4
  "cell_type": "code",
5
- "execution_count": 23,
5
+ "execution_count": 30,
6
6
  "id": "b6976e0e-c64e-457a-9f28-6728d6ff75cd",
7
7
  "metadata": {},
8
8
  "outputs": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  {
17
17
  "cell_type": "code",
18
- "execution_count": 24,
18
+ "execution_count": 31,
19
19
  "id": "ce167daa-5219-47a4-9c5c-e857f45f8457",
20
20
  "metadata": {},
21
21
  "outputs": [
@@ -126,7 +126,7 @@
126
126
  "4 3450.0 Female 24 "
127
127
  ]
128
128
  },
129
- "execution_count": 24,
129
+ "execution_count": 31,
130
130
  "metadata": {},
131
131
  "output_type": "execute_result"
132
132
  }
@@ -142,7 +142,7 @@
142
142
  },
143
143
  {
144
144
  "cell_type": "code",
145
- "execution_count": 25,
145
+ "execution_count": 32,
146
146
  "id": "1f6c2d54-67d9-48b1-b25d-e405269c84ee",
147
147
  "metadata": {},
148
148
  "outputs": [
@@ -228,7 +228,7 @@
228
228
  "4 Adelie Torgersen Female bill_length_mm 36.7"
229
229
  ]
230
230
  },
231
- "execution_count": 25,
231
+ "execution_count": 32,
232
232
  "metadata": {},
233
233
  "output_type": "execute_result"
234
234
  }
@@ -239,7 +239,7 @@
239
239
  },
240
240
  {
241
241
  "cell_type": "code",
242
- "execution_count": 26,
242
+ "execution_count": 33,
243
243
  "id": "c83b26a1-fe4e-450a-95a1-292116562dff",
244
244
  "metadata": {},
245
245
  "outputs": [
@@ -325,7 +325,7 @@
325
325
  "4 Adelie Torgersen Female bill_length_mm 36.7"
326
326
  ]
327
327
  },
328
- "execution_count": 26,
328
+ "execution_count": 33,
329
329
  "metadata": {},
330
330
  "output_type": "execute_result"
331
331
  }
@@ -336,7 +336,7 @@
336
336
  },
337
337
  {
338
338
  "cell_type": "code",
339
- "execution_count": 27,
339
+ "execution_count": 34,
340
340
  "id": "2582f05d-ddf4-46ae-8362-34aaa5d05fe4",
341
341
  "metadata": {},
342
342
  "outputs": [
@@ -454,7 +454,7 @@
454
454
  "4 4519.0 576.0 "
455
455
  ]
456
456
  },
457
- "execution_count": 27,
457
+ "execution_count": 34,
458
458
  "metadata": {},
459
459
  "output_type": "execute_result"
460
460
  }
@@ -466,7 +466,7 @@
466
466
  },
467
467
  {
468
468
  "cell_type": "code",
469
- "execution_count": 28,
469
+ "execution_count": 35,
470
470
  "id": "2a6e93dc-703a-4ae4-84de-6364728b6e6f",
471
471
  "metadata": {},
472
472
  "outputs": [
@@ -638,7 +638,7 @@
638
638
  "9 13514.0 "
639
639
  ]
640
640
  },
641
- "execution_count": 28,
641
+ "execution_count": 35,
642
642
  "metadata": {},
643
643
  "output_type": "execute_result"
644
644
  }
@@ -650,7 +650,7 @@
650
650
  },
651
651
  {
652
652
  "cell_type": "code",
653
- "execution_count": 29,
653
+ "execution_count": 36,
654
654
  "id": "37cbef19-3391-4ec0-be90-4d4d333d3987",
655
655
  "metadata": {},
656
656
  "outputs": [
@@ -667,7 +667,7 @@
667
667
  " 'species']"
668
668
  ]
669
669
  },
670
- "execution_count": 29,
670
+ "execution_count": 36,
671
671
  "metadata": {},
672
672
  "output_type": "execute_result"
673
673
  }
@@ -2,7 +2,7 @@
2
2
  "cells": [
3
3
  {
4
4
  "cell_type": "code",
5
- "execution_count": 17,
5
+ "execution_count": 29,
6
6
  "id": "e1e35300-a92f-47dd-b448-83861e79eedf",
7
7
  "metadata": {},
8
8
  "outputs": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  {
17
17
  "cell_type": "code",
18
- "execution_count": 18,
18
+ "execution_count": 30,
19
19
  "id": "c3f73408-8dc7-4ea5-899b-e3b23a692cd8",
20
20
  "metadata": {},
21
21
  "outputs": [],
@@ -27,7 +27,7 @@
27
27
  },
28
28
  {
29
29
  "cell_type": "code",
30
- "execution_count": 19,
30
+ "execution_count": 31,
31
31
  "id": "db20c1c7-c11f-431d-ae9c-d0c424f0d423",
32
32
  "metadata": {},
33
33
  "outputs": [
@@ -139,7 +139,7 @@
139
139
  "6 f 45 20 22.5 25 2"
140
140
  ]
141
141
  },
142
- "execution_count": 19,
142
+ "execution_count": 31,
143
143
  "metadata": {},
144
144
  "output_type": "execute_result"
145
145
  }
@@ -150,7 +150,7 @@
150
150
  },
151
151
  {
152
152
  "cell_type": "code",
153
- "execution_count": 20,
153
+ "execution_count": 32,
154
154
  "id": "66cb16ac-30b8-491e-94b4-0a2065d1e29b",
155
155
  "metadata": {},
156
156
  "outputs": [
@@ -230,7 +230,7 @@
230
230
  "6 f 45"
231
231
  ]
232
232
  },
233
- "execution_count": 20,
233
+ "execution_count": 32,
234
234
  "metadata": {},
235
235
  "output_type": "execute_result"
236
236
  }
@@ -243,7 +243,7 @@
243
243
  },
244
244
  {
245
245
  "cell_type": "code",
246
- "execution_count": 21,
246
+ "execution_count": 33,
247
247
  "id": "cbf32f4b-5f41-4ea7-bfa4-9f884d714f31",
248
248
  "metadata": {},
249
249
  "outputs": [
@@ -419,7 +419,7 @@
419
419
  "9 13514.0 334575.0 "
420
420
  ]
421
421
  },
422
- "execution_count": 21,
422
+ "execution_count": 33,
423
423
  "metadata": {},
424
424
  "output_type": "execute_result"
425
425
  }
@@ -431,7 +431,7 @@
431
431
  {
432
432
  "cell_type": "code",
433
433
  "execution_count": null,
434
- "id": "773cca3c-564a-4c3a-bfcf-12b5ddfa6683",
434
+ "id": "8a7d5322-31ef-4e03-abfd-4220b12c2520",
435
435
  "metadata": {},
436
436
  "outputs": [],
437
437
  "source": []
@@ -2,7 +2,7 @@
2
2
  "cells": [
3
3
  {
4
4
  "cell_type": "code",
5
- "execution_count": 9,
5
+ "execution_count": 11,
6
6
  "id": "0fe64a26-2fb9-4272-b389-768653879781",
7
7
  "metadata": {},
8
8
  "outputs": [],
@@ -18,7 +18,7 @@
18
18
  },
19
19
  {
20
20
  "cell_type": "code",
21
- "execution_count": 10,
21
+ "execution_count": 12,
22
22
  "id": "71ff2554-e610-4592-a019-c3bc2b0c536d",
23
23
  "metadata": {},
24
24
  "outputs": [
@@ -104,7 +104,7 @@
104
104
  "4 Dream NaN Adelie 2975.0 37.5"
105
105
  ]
106
106
  },
107
- "execution_count": 10,
107
+ "execution_count": 12,
108
108
  "metadata": {},
109
109
  "output_type": "execute_result"
110
110
  }
@@ -117,7 +117,7 @@
117
117
  },
118
118
  {
119
119
  "cell_type": "code",
120
- "execution_count": 11,
120
+ "execution_count": 13,
121
121
  "id": "9ed6f23b-f588-4651-9db4-3cfb56b37a9b",
122
122
  "metadata": {},
123
123
  "outputs": [
@@ -142,8 +142,8 @@
142
142
  " <thead>\n",
143
143
  " <tr style=\"text-align: right;\">\n",
144
144
  " <th></th>\n",
145
- " <th>island</th>\n",
146
145
  " <th>sex</th>\n",
146
+ " <th>island</th>\n",
147
147
  " <th>species</th>\n",
148
148
  " <th>body_mass_g</th>\n",
149
149
  " </tr>\n",
@@ -151,36 +151,36 @@
151
151
  " <tbody>\n",
152
152
  " <tr>\n",
153
153
  " <th>0</th>\n",
154
- " <td>Biscoe</td>\n",
155
154
  " <td>Male</td>\n",
155
+ " <td>Biscoe</td>\n",
156
156
  " <td>Adelie</td>\n",
157
157
  " <td>89100.0</td>\n",
158
158
  " </tr>\n",
159
159
  " <tr>\n",
160
160
  " <th>1</th>\n",
161
- " <td>Biscoe</td>\n",
162
161
  " <td>Male</td>\n",
162
+ " <td>Biscoe</td>\n",
163
163
  " <td>Gentoo</td>\n",
164
164
  " <td>334575.0</td>\n",
165
165
  " </tr>\n",
166
166
  " <tr>\n",
167
167
  " <th>2</th>\n",
168
- " <td>Dream</td>\n",
169
168
  " <td>Male</td>\n",
169
+ " <td>Dream</td>\n",
170
170
  " <td>Adelie</td>\n",
171
171
  " <td>113275.0</td>\n",
172
172
  " </tr>\n",
173
173
  " <tr>\n",
174
174
  " <th>3</th>\n",
175
- " <td>Dream</td>\n",
176
175
  " <td>Male</td>\n",
176
+ " <td>Dream</td>\n",
177
177
  " <td>Chinstrap</td>\n",
178
178
  " <td>133925.0</td>\n",
179
179
  " </tr>\n",
180
180
  " <tr>\n",
181
181
  " <th>4</th>\n",
182
- " <td>Torgersen</td>\n",
183
182
  " <td>Male</td>\n",
183
+ " <td>Torgersen</td>\n",
184
184
  " <td>Adelie</td>\n",
185
185
  " <td>92800.0</td>\n",
186
186
  " </tr>\n",
@@ -189,15 +189,15 @@
189
189
  "</div>"
190
190
  ],
191
191
  "text/plain": [
192
- " island sex species body_mass_g\n",
193
- "0 Biscoe Male Adelie 89100.0\n",
194
- "1 Biscoe Male Gentoo 334575.0\n",
195
- "2 Dream Male Adelie 113275.0\n",
196
- "3 Dream Male Chinstrap 133925.0\n",
197
- "4 Torgersen Male Adelie 92800.0"
192
+ " sex island species body_mass_g\n",
193
+ "0 Male Biscoe Adelie 89100.0\n",
194
+ "1 Male Biscoe Gentoo 334575.0\n",
195
+ "2 Male Dream Adelie 113275.0\n",
196
+ "3 Male Dream Chinstrap 133925.0\n",
197
+ "4 Male Torgersen Adelie 92800.0"
198
198
  ]
199
199
  },
200
- "execution_count": 11,
200
+ "execution_count": 13,
201
201
  "metadata": {},
202
202
  "output_type": "execute_result"
203
203
  }
@@ -205,14 +205,144 @@
205
205
  "source": [
206
206
  "penguins.get_data(value='body_mass_g',sex=['Male'],\n",
207
207
  " default_cols=['island','sex','species'],\n",
208
- " agg_func='sum')"
208
+ " aggfunc='sum')"
209
209
  ]
210
210
  },
211
211
  {
212
212
  "cell_type": "code",
213
- "execution_count": null,
213
+ "execution_count": 14,
214
214
  "id": "2e9408f6-09bf-4893-8c21-87c791dbe65e",
215
215
  "metadata": {},
216
+ "outputs": [
217
+ {
218
+ "data": {
219
+ "text/html": [
220
+ "<div>\n",
221
+ "<style scoped>\n",
222
+ " .dataframe tbody tr th:only-of-type {\n",
223
+ " vertical-align: middle;\n",
224
+ " }\n",
225
+ "\n",
226
+ " .dataframe tbody tr th {\n",
227
+ " vertical-align: top;\n",
228
+ " }\n",
229
+ "\n",
230
+ " .dataframe thead th {\n",
231
+ " text-align: right;\n",
232
+ " }\n",
233
+ "</style>\n",
234
+ "<table border=\"1\" class=\"dataframe\">\n",
235
+ " <thead>\n",
236
+ " <tr style=\"text-align: right;\">\n",
237
+ " <th></th>\n",
238
+ " <th>species</th>\n",
239
+ " <th>body_mass_g</th>\n",
240
+ " </tr>\n",
241
+ " </thead>\n",
242
+ " <tbody>\n",
243
+ " <tr>\n",
244
+ " <th>0</th>\n",
245
+ " <td>Adelie</td>\n",
246
+ " <td>3700.662252</td>\n",
247
+ " </tr>\n",
248
+ " <tr>\n",
249
+ " <th>1</th>\n",
250
+ " <td>Chinstrap</td>\n",
251
+ " <td>3733.088235</td>\n",
252
+ " </tr>\n",
253
+ " <tr>\n",
254
+ " <th>2</th>\n",
255
+ " <td>Gentoo</td>\n",
256
+ " <td>5076.016260</td>\n",
257
+ " </tr>\n",
258
+ " </tbody>\n",
259
+ "</table>\n",
260
+ "</div>"
261
+ ],
262
+ "text/plain": [
263
+ " species body_mass_g\n",
264
+ "0 Adelie 3700.662252\n",
265
+ "1 Chinstrap 3733.088235\n",
266
+ "2 Gentoo 5076.016260"
267
+ ]
268
+ },
269
+ "execution_count": 14,
270
+ "metadata": {},
271
+ "output_type": "execute_result"
272
+ }
273
+ ],
274
+ "source": [
275
+ "penguins.get_data(value=['body_mass_g'],\n",
276
+ " default_cols=['species'],\n",
277
+ " aggfunc='mean')"
278
+ ]
279
+ },
280
+ {
281
+ "cell_type": "code",
282
+ "execution_count": 15,
283
+ "id": "6d82acc4-bbfb-4bd0-89f5-74571341cc84",
284
+ "metadata": {},
285
+ "outputs": [
286
+ {
287
+ "data": {
288
+ "text/html": [
289
+ "<div>\n",
290
+ "<style scoped>\n",
291
+ " .dataframe tbody tr th:only-of-type {\n",
292
+ " vertical-align: middle;\n",
293
+ " }\n",
294
+ "\n",
295
+ " .dataframe tbody tr th {\n",
296
+ " vertical-align: top;\n",
297
+ " }\n",
298
+ "\n",
299
+ " .dataframe thead th {\n",
300
+ " text-align: right;\n",
301
+ " }\n",
302
+ "</style>\n",
303
+ "<table border=\"1\" class=\"dataframe\">\n",
304
+ " <thead>\n",
305
+ " <tr style=\"text-align: right;\">\n",
306
+ " <th></th>\n",
307
+ " <th>index</th>\n",
308
+ " <th>Adelie</th>\n",
309
+ " <th>Chinstrap</th>\n",
310
+ " <th>Gentoo</th>\n",
311
+ " </tr>\n",
312
+ " </thead>\n",
313
+ " <tbody>\n",
314
+ " <tr>\n",
315
+ " <th>0</th>\n",
316
+ " <td>body_mass_g</td>\n",
317
+ " <td>3700.662252</td>\n",
318
+ " <td>3733.088235</td>\n",
319
+ " <td>5076.01626</td>\n",
320
+ " </tr>\n",
321
+ " </tbody>\n",
322
+ "</table>\n",
323
+ "</div>"
324
+ ],
325
+ "text/plain": [
326
+ " index Adelie Chinstrap Gentoo\n",
327
+ "0 body_mass_g 3700.662252 3733.088235 5076.01626"
328
+ ]
329
+ },
330
+ "execution_count": 15,
331
+ "metadata": {},
332
+ "output_type": "execute_result"
333
+ }
334
+ ],
335
+ "source": [
336
+ "penguins.get_data(value=['body_mass_g'],\n",
337
+ " default_cols=['species'],\n",
338
+ " aggfunc='mean').wide(col='species',value='body_mass_g')"
339
+ ]
340
+ },
341
+ {
342
+ "cell_type": "code",
343
+ "execution_count": null,
344
+ "id": "f698a627-4754-4ac1-ba0a-e6f7271214e7",
345
+ "metadata": {},
216
346
  "outputs": [],
217
347
  "source": []
218
348
  }
@@ -2,7 +2,7 @@
2
2
  "cells": [
3
3
  {
4
4
  "cell_type": "code",
5
- "execution_count": 6,
5
+ "execution_count": 16,
6
6
  "id": "af0e75c1-7748-44e7-974e-34112d92d813",
7
7
  "metadata": {},
8
8
  "outputs": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  {
17
17
  "cell_type": "code",
18
- "execution_count": 7,
18
+ "execution_count": 17,
19
19
  "id": "e42e01b5-4b00-4f95-acec-274deda67a3c",
20
20
  "metadata": {},
21
21
  "outputs": [
@@ -31,7 +31,7 @@
31
31
  " 'species']"
32
32
  ]
33
33
  },
34
- "execution_count": 7,
34
+ "execution_count": 17,
35
35
  "metadata": {},
36
36
  "output_type": "execute_result"
37
37
  }
@@ -43,7 +43,7 @@
43
43
  },
44
44
  {
45
45
  "cell_type": "code",
46
- "execution_count": 8,
46
+ "execution_count": 18,
47
47
  "id": "e7136bed-d2e1-48c5-a337-8e31fc020a98",
48
48
  "metadata": {},
49
49
  "outputs": [
@@ -154,7 +154,7 @@
154
154
  "4 3450.0 Female 24 "
155
155
  ]
156
156
  },
157
- "execution_count": 8,
157
+ "execution_count": 18,
158
158
  "metadata": {},
159
159
  "output_type": "execute_result"
160
160
  }
@@ -170,7 +170,7 @@
170
170
  },
171
171
  {
172
172
  "cell_type": "code",
173
- "execution_count": 9,
173
+ "execution_count": 19,
174
174
  "id": "87e3dd20-d5e1-4219-8aee-e842a3d52194",
175
175
  "metadata": {},
176
176
  "outputs": [
@@ -275,7 +275,7 @@
275
275
  "4 3450.0 Female "
276
276
  ]
277
277
  },
278
- "execution_count": 9,
278
+ "execution_count": 19,
279
279
  "metadata": {},
280
280
  "output_type": "execute_result"
281
281
  }
@@ -292,7 +292,7 @@
292
292
  },
293
293
  {
294
294
  "cell_type": "code",
295
- "execution_count": 10,
295
+ "execution_count": 20,
296
296
  "id": "b17a9574-35ff-4fe2-b40f-054a0b5e5003",
297
297
  "metadata": {},
298
298
  "outputs": [],
@@ -49,4 +49,6 @@ def get_data(self, **kwargs):
49
49
 
50
50
  return grouped_self
51
51
 
52
+
53
+
52
54
  pd.DataFrame.get_data = get_data
@@ -52,7 +52,7 @@ def wide(df, **kwargs):
52
52
  """
53
53
  col = kwargs.get('col', 'variable')
54
54
  value = kwargs.get('value', 'value')
55
- aggfunc = kwargs.get('aggfunc', None)
55
+ aggfunc = kwargs.get('aggfunc', 'sum')
56
56
  dropna = kwargs.get('dropna', True)
57
57
 
58
58
  index_cols = [c for c in df.columns if c not in [col, value]]
@@ -60,12 +60,13 @@ def wide(df, **kwargs):
60
60
  if aggfunc is None:
61
61
  try:
62
62
  wide_df = df.pivot(index=index_cols, columns=col, values=value).reset_index()
63
- except ValueError as e:
64
- if 'Index contains duplicate entries' in str(e):
65
- print("pivot_table is used with 'sum' as aggfunc because Index contains duplicate entries.")
66
- wide_df = df.pivot_table(index=index_cols, columns=col, values=value, aggfunc='sum', dropna=dropna).reset_index()
67
- else:
68
- raise
63
+ except:
64
+
65
+ # if 'Index contains duplicate entries' in str(e):
66
+ print("pivot_table is used instead of pivot!")
67
+ wide_df = df.pivot_table(index=index_cols, columns=col, values=value, aggfunc=aggfunc, dropna=dropna).reset_index()
68
+ # else:
69
+ # raise
69
70
  else:
70
71
  wide_df = df.pivot_table(index=index_cols, columns=col, values=value, aggfunc=aggfunc, dropna=dropna).reset_index()
71
72
 
@@ -49,4 +49,6 @@ def get_data(self, **kwargs):
49
49
 
50
50
  return grouped_self
51
51
 
52
+
53
+
52
54
  pd.DataFrame.get_data = get_data
@@ -52,7 +52,7 @@ def wide(df, **kwargs):
52
52
  """
53
53
  col = kwargs.get('col', 'variable')
54
54
  value = kwargs.get('value', 'value')
55
- aggfunc = kwargs.get('aggfunc', None)
55
+ aggfunc = kwargs.get('aggfunc', 'sum')
56
56
  dropna = kwargs.get('dropna', True)
57
57
 
58
58
  index_cols = [c for c in df.columns if c not in [col, value]]
@@ -60,12 +60,13 @@ def wide(df, **kwargs):
60
60
  if aggfunc is None:
61
61
  try:
62
62
  wide_df = df.pivot(index=index_cols, columns=col, values=value).reset_index()
63
- except ValueError as e:
64
- if 'Index contains duplicate entries' in str(e):
65
- print("pivot_table is used with 'sum' as aggfunc because Index contains duplicate entries.")
66
- wide_df = df.pivot_table(index=index_cols, columns=col, values=value, aggfunc='sum', dropna=dropna).reset_index()
67
- else:
68
- raise
63
+ except:
64
+
65
+ # if 'Index contains duplicate entries' in str(e):
66
+ print("pivot_table is used instead of pivot!")
67
+ wide_df = df.pivot_table(index=index_cols, columns=col, values=value, aggfunc=aggfunc, dropna=dropna).reset_index()
68
+ # else:
69
+ # raise
69
70
  else:
70
71
  wide_df = df.pivot_table(index=index_cols, columns=col, values=value, aggfunc=aggfunc, dropna=dropna).reset_index()
71
72
 
@@ -2,7 +2,7 @@
2
2
  "cells": [
3
3
  {
4
4
  "cell_type": "code",
5
- "execution_count": 23,
5
+ "execution_count": 30,
6
6
  "id": "b6976e0e-c64e-457a-9f28-6728d6ff75cd",
7
7
  "metadata": {},
8
8
  "outputs": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  {
17
17
  "cell_type": "code",
18
- "execution_count": 24,
18
+ "execution_count": 31,
19
19
  "id": "ce167daa-5219-47a4-9c5c-e857f45f8457",
20
20
  "metadata": {},
21
21
  "outputs": [
@@ -126,7 +126,7 @@
126
126
  "4 3450.0 Female 24 "
127
127
  ]
128
128
  },
129
- "execution_count": 24,
129
+ "execution_count": 31,
130
130
  "metadata": {},
131
131
  "output_type": "execute_result"
132
132
  }
@@ -142,7 +142,7 @@
142
142
  },
143
143
  {
144
144
  "cell_type": "code",
145
- "execution_count": 25,
145
+ "execution_count": 32,
146
146
  "id": "1f6c2d54-67d9-48b1-b25d-e405269c84ee",
147
147
  "metadata": {},
148
148
  "outputs": [
@@ -228,7 +228,7 @@
228
228
  "4 Adelie Torgersen Female bill_length_mm 36.7"
229
229
  ]
230
230
  },
231
- "execution_count": 25,
231
+ "execution_count": 32,
232
232
  "metadata": {},
233
233
  "output_type": "execute_result"
234
234
  }
@@ -239,7 +239,7 @@
239
239
  },
240
240
  {
241
241
  "cell_type": "code",
242
- "execution_count": 26,
242
+ "execution_count": 33,
243
243
  "id": "c83b26a1-fe4e-450a-95a1-292116562dff",
244
244
  "metadata": {},
245
245
  "outputs": [
@@ -325,7 +325,7 @@
325
325
  "4 Adelie Torgersen Female bill_length_mm 36.7"
326
326
  ]
327
327
  },
328
- "execution_count": 26,
328
+ "execution_count": 33,
329
329
  "metadata": {},
330
330
  "output_type": "execute_result"
331
331
  }
@@ -336,7 +336,7 @@
336
336
  },
337
337
  {
338
338
  "cell_type": "code",
339
- "execution_count": 27,
339
+ "execution_count": 34,
340
340
  "id": "2582f05d-ddf4-46ae-8362-34aaa5d05fe4",
341
341
  "metadata": {},
342
342
  "outputs": [
@@ -454,7 +454,7 @@
454
454
  "4 4519.0 576.0 "
455
455
  ]
456
456
  },
457
- "execution_count": 27,
457
+ "execution_count": 34,
458
458
  "metadata": {},
459
459
  "output_type": "execute_result"
460
460
  }
@@ -466,7 +466,7 @@
466
466
  },
467
467
  {
468
468
  "cell_type": "code",
469
- "execution_count": 28,
469
+ "execution_count": 35,
470
470
  "id": "2a6e93dc-703a-4ae4-84de-6364728b6e6f",
471
471
  "metadata": {},
472
472
  "outputs": [
@@ -638,7 +638,7 @@
638
638
  "9 13514.0 "
639
639
  ]
640
640
  },
641
- "execution_count": 28,
641
+ "execution_count": 35,
642
642
  "metadata": {},
643
643
  "output_type": "execute_result"
644
644
  }
@@ -650,7 +650,7 @@
650
650
  },
651
651
  {
652
652
  "cell_type": "code",
653
- "execution_count": 29,
653
+ "execution_count": 36,
654
654
  "id": "37cbef19-3391-4ec0-be90-4d4d333d3987",
655
655
  "metadata": {},
656
656
  "outputs": [
@@ -667,7 +667,7 @@
667
667
  " 'species']"
668
668
  ]
669
669
  },
670
- "execution_count": 29,
670
+ "execution_count": 36,
671
671
  "metadata": {},
672
672
  "output_type": "execute_result"
673
673
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes