Commit 04356be
authored
Fix binary operations on attrs for Series and DataFrame (#59636)
* Fix binary operators on attrs for Series and DataFrame
* Add tests for Series and DataFrame for attrs binary operations
* Add getattr as other might not possess attrs as attribute
* Fix some tests in pandas/tests/generic/test_finalize.py::test_binops
* remove xfail tests related to attrs
* Add all_binary_operators
* use __finalize__ for attrs bin ops in base.py
* use __finalize__ for attrs bin ops in frame.py
* use __finalize__ for attrs bin ops in series.py
* ENH: Ensure attrs are copied from other in Series arithmetic operations. Moved from base.py to series.py
* REF: Refactor binary operation tests for DataFrame and Series attributes
* REF: Enhance _construct_result method to accept 'other' parameter for improved attribute handling
* REF: Simplify test_attrs_binary_operations by parameterizing left and right inputs
* Refactor DataFrame and Series methods to improve attribute handling and finalize behavior
* Refactor DataFrame alignment logic to improve attribute consistency
* Refactor DataFrame and Series methods to enhance attribute finalization logic
* Clean and remove unnecessry checks
* Fix: Prioritizing False if self.flags.allows_duplicate_labels or other.flags.allows_duplicate_labels is False1 parent b8abe06 commit 04356be
File tree
6 files changed
+40
-68
lines changed- pandas
- core
- indexes
- tests/generic
6 files changed
+40
-68
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1480 | 1480 | | |
1481 | 1481 | | |
1482 | 1482 | | |
1483 | | - | |
| 1483 | + | |
1484 | 1484 | | |
1485 | | - | |
| 1485 | + | |
1486 | 1486 | | |
1487 | 1487 | | |
1488 | 1488 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7879 | 7879 | | |
7880 | 7880 | | |
7881 | 7881 | | |
7882 | | - | |
| 7882 | + | |
7883 | 7883 | | |
7884 | 7884 | | |
7885 | 7885 | | |
| |||
7892 | 7892 | | |
7893 | 7893 | | |
7894 | 7894 | | |
7895 | | - | |
| 7895 | + | |
7896 | 7896 | | |
7897 | 7897 | | |
7898 | 7898 | | |
| |||
8088 | 8088 | | |
8089 | 8089 | | |
8090 | 8090 | | |
8091 | | - | |
8092 | | - | |
| 8091 | + | |
8093 | 8092 | | |
8094 | 8093 | | |
8095 | 8094 | | |
| |||
8208 | 8207 | | |
8209 | 8208 | | |
8210 | 8209 | | |
8211 | | - | |
8212 | 8210 | | |
8213 | 8211 | | |
8214 | 8212 | | |
| |||
8237 | 8235 | | |
8238 | 8236 | | |
8239 | 8237 | | |
8240 | | - | |
| 8238 | + | |
8241 | 8239 | | |
8242 | 8240 | | |
8243 | 8241 | | |
| |||
8269 | 8267 | | |
8270 | 8268 | | |
8271 | 8269 | | |
8272 | | - | |
| 8270 | + | |
8273 | 8271 | | |
8274 | | - | |
| 8272 | + | |
8275 | 8273 | | |
8276 | 8274 | | |
8277 | 8275 | | |
| |||
8288 | 8286 | | |
8289 | 8287 | | |
8290 | 8288 | | |
| 8289 | + | |
8291 | 8290 | | |
8292 | 8291 | | |
8293 | 8292 | | |
| |||
8308 | 8307 | | |
8309 | 8308 | | |
8310 | 8309 | | |
8311 | | - | |
| 8310 | + | |
8312 | 8311 | | |
8313 | 8312 | | |
8314 | 8313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6076 | 6076 | | |
6077 | 6077 | | |
6078 | 6078 | | |
6079 | | - | |
6080 | | - | |
| 6079 | + | |
| 6080 | + | |
| 6081 | + | |
| 6082 | + | |
6081 | 6083 | | |
6082 | 6084 | | |
6083 | 6085 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7148 | 7148 | | |
7149 | 7149 | | |
7150 | 7150 | | |
7151 | | - | |
| 7151 | + | |
7152 | 7152 | | |
7153 | 7153 | | |
7154 | | - | |
| 7154 | + | |
7155 | 7155 | | |
7156 | 7156 | | |
7157 | 7157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5858 | 5858 | | |
5859 | 5859 | | |
5860 | 5860 | | |
5861 | | - | |
| 5861 | + | |
5862 | 5862 | | |
5863 | 5863 | | |
5864 | 5864 | | |
| |||
5868 | 5868 | | |
5869 | 5869 | | |
5870 | 5870 | | |
5871 | | - | |
| 5871 | + | |
5872 | 5872 | | |
5873 | 5873 | | |
5874 | 5874 | | |
| |||
5930 | 5930 | | |
5931 | 5931 | | |
5932 | 5932 | | |
5933 | | - | |
| 5933 | + | |
| 5934 | + | |
5934 | 5935 | | |
5935 | 5936 | | |
5936 | 5937 | | |
5937 | | - | |
| 5938 | + | |
| 5939 | + | |
| 5940 | + | |
| 5941 | + | |
5938 | 5942 | | |
5939 | 5943 | | |
5940 | 5944 | | |
| |||
5943 | 5947 | | |
5944 | 5948 | | |
5945 | 5949 | | |
| 5950 | + | |
5946 | 5951 | | |
5947 | 5952 | | |
5948 | 5953 | | |
| |||
5952 | 5957 | | |
5953 | 5958 | | |
5954 | 5959 | | |
5955 | | - | |
5956 | | - | |
| 5960 | + | |
| 5961 | + | |
5957 | 5962 | | |
5958 | 5963 | | |
5959 | 5964 | | |
| |||
5965 | 5970 | | |
5966 | 5971 | | |
5967 | 5972 | | |
| 5973 | + | |
5968 | 5974 | | |
5969 | 5975 | | |
5970 | 5976 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | 430 | | |
478 | 431 | | |
479 | 432 | | |
| |||
497 | 450 | | |
498 | 451 | | |
499 | 452 | | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
500 | 465 | | |
501 | 466 | | |
502 | 467 | | |
| |||
0 commit comments