Commit 823d890
committed
Fix alignment in Series subtraction with MultiIndex and NaN (GH#60908)
Fixes an issue where subtracting a Series with a MultiIndex containing
NaN values from a regular Index Series led to incorrect results.
Updated _align_for_op to properly reindex right-hand Series based on
the first level of the MultiIndex and handle empty Series cases.
Added test_subtraction_nanindex to ensure correct behavior.1 parent a811388 commit 823d890
File tree
2 files changed
+65
-23
lines changed- pandas
- core
- tests/series
2 files changed
+65
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5890 | 5890 | | |
5891 | 5891 | | |
5892 | 5892 | | |
5893 | | - | |
5894 | | - | |
5895 | | - | |
5896 | | - | |
5897 | | - | |
| 5893 | + | |
| 5894 | + | |
| 5895 | + | |
5898 | 5896 | | |
5899 | 5897 | | |
5900 | | - | |
5901 | | - | |
5902 | | - | |
5903 | | - | |
5904 | | - | |
5905 | | - | |
5906 | | - | |
5907 | | - | |
5908 | | - | |
5909 | | - | |
5910 | | - | |
5911 | | - | |
5912 | | - | |
5913 | | - | |
5914 | | - | |
5915 | | - | |
5916 | | - | |
5917 | | - | |
| 5898 | + | |
| 5899 | + | |
| 5900 | + | |
| 5901 | + | |
| 5902 | + | |
5918 | 5903 | | |
| 5904 | + | |
| 5905 | + | |
| 5906 | + | |
| 5907 | + | |
| 5908 | + | |
| 5909 | + | |
| 5910 | + | |
| 5911 | + | |
| 5912 | + | |
| 5913 | + | |
| 5914 | + | |
| 5915 | + | |
| 5916 | + | |
| 5917 | + | |
| 5918 | + | |
| 5919 | + | |
| 5920 | + | |
| 5921 | + | |
| 5922 | + | |
5919 | 5923 | | |
5920 | 5924 | | |
5921 | 5925 | | |
| |||
| 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 | + | |
0 commit comments