Commit b5953aa
ENH: Add cumulative methods to ea (#48111)
* define accumulation interface for ExtensionArrays
* reformulate doc string
* creates baseExtension tests for accumulate
* adds fixtures for numeric_accumulations
* fixes typos
* adds accumulate tests for integer arrays
* fixes typo
* first implementation of cumsum
* stashed merge conflict
* fixes formatting
* first green test for integer extension arrays and cumsum
* first passing tests for cummin and cummax
* utilizes na_accum_func
* removes delegation leftover
* creates running tests
* removes ABCExtensionArray Type hint
* removes clutter from generic.py
* removes clutter in _accumulate
* adds typehints for ExtensionArray and IntegerArray
* delegates the accumulate calls to extension arrays
* removes diff in nanops
* removes unwanted pattern
* makes output types for sum and prod explicit
* makes the base accumulate test more general by not comparing types
* implements accumulation for boolean arrays
* uses f-string in base.py
* uses blockmanager also for extension arrays
* fixes flake8 issues
* removes uncommented code
* adds todo for runtime warning
* reuses integer array to accumulate for booleans
* removes runtimewarning catching
* removes TODOs
* adds accumulate to autosummary
* excludes datetime from propagating to _accumulate
* uses pandas.testing instead of pandas.util.testing in accumulate
* replaces assert_almost_equal with assert_series_equal
* dtypes to lowercase
* lowercase of uint and int64 dtype in _accumulate
* uses hint of @simonjayhawkins concerning assert series equals
* adds whatsnew entry
* moves changes to 1.2.0
* uses na_accum_func
* delegate to EAs _accumulate function in block mgr
* moves implementation from nanops to masked_accumulations
* fixes typing annotations in base and masked
* fixes merge error
* fills na values without nanops
* fixes incorrect call to cumsum and changes to cumprod
* add _accumulate to boolean
* makes tests a lot easier - cumprod tests still fail
* adds BaseNumericAccumulation for floating masked array
* tests no numeric accumulations according to _accumulate interface
* uses NotImplementedError in base accumulate function
* ensures the fill values are data independent
additionally, remove min_count as irrellevant
* adds accumulation for datetimelikes
in generic.py ensure that datetimelikes are wrapped
create a twin of masked_accumulations for datetimelikes
timedeltas also allow cumsum and cumprod, theoretically
* actually ads datetimelike accumulation algos
* fixes absolute imports
* changes error to catch to adhere to changed implementation
* Remove blank line in old whatsnew
* Remove merge error
* Fix additional merge errors
* Refactor datetimelike accum funcs
* Remove unnecessary import
* Refactor tests
* Skip test
* Fix mypy
* Fix dtype creation
* Fix cumprod tests
* Fix docstring
* Adress review
* Adress review
* Update pandas/core/arrays/base.py
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
* Update pandas/tests/extension/test_integer.py
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
* Add comment
* Clarify comment
* Fix pre commit
* Add whatsnew
* Move to top of file
* Change error
* Change _data
* Remove
* Add todo
* Fix typo
* Adjust var
* Special case
* Fix tests
* Combine classes
* Fix mypy
Co-authored-by: Jan Koch <Jan.Koch@tu-dortmund.de>
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>1 parent 5a372d8 commit b5953aa
File tree
17 files changed
+341
-3
lines changed- doc/source
- reference
- whatsnew
- pandas
- core
- array_algos
- arrays
- tests/extension
- base
17 files changed
+341
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1123 | 1123 | | |
1124 | 1124 | | |
1125 | 1125 | | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
1126 | 1137 | | |
1127 | 1138 | | |
1128 | 1139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
| |||
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
185 | | - | |
| 186 | + | |
186 | 187 | | |
| 188 | + | |
187 | 189 | | |
188 | 190 | | |
189 | 191 | | |
| |||
1368 | 1370 | | |
1369 | 1371 | | |
1370 | 1372 | | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
1371 | 1405 | | |
1372 | 1406 | | |
1373 | 1407 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
378 | 379 | | |
379 | 380 | | |
380 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1352 | 1352 | | |
1353 | 1353 | | |
1354 | 1354 | | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
1355 | 1376 | | |
1356 | 1377 | | |
1357 | 1378 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
| |||
1328 | 1331 | | |
1329 | 1332 | | |
1330 | 1333 | | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
413 | 430 | | |
414 | 431 | | |
415 | 432 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10828 | 10828 | | |
10829 | 10829 | | |
10830 | 10830 | | |
10831 | | - | |
| 10831 | + | |
| 10832 | + | |
| 10833 | + | |
| 10834 | + | |
| 10835 | + | |
10832 | 10836 | | |
10833 | 10837 | | |
10834 | 10838 | | |
| |||
0 commit comments