Commit 41dfccc
authored
* Changed the default value for sort to 'False' in the difference method. This allows the difference method to then call the _difference method and finally call the _maybe_try_sort method. In the _maybe_try_sort_method it will sort the values if sort is not False. That's why in the original code haveing sort=None would still sort the categories. This way the code will only sort if you set sort=True.
* Added test to show the variable value change behaves the way we want it to.
* Added bug fix to whatsnew.
* Changed bug fix implementation to simply check if the Ordered value is set to True, if so it sets sort=False in the call to difference in remove_categories.
* Changed bug fix implementation to simply check if the Ordered value is set to True, if so it sets sort=False in the call to difference in remove_categories.
* Switched the implementation to a ternary to check for ordered. This seems to work better since we are not overriding a default argument this way.
1 parent 9d1d1b1 commit 41dfccc
File tree
3 files changed
+21
-1
lines changed- doc/source/whatsnew
- pandas
- core/arrays
- tests/indexes/categorical
3 files changed
+21
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
| 379 | + | |
379 | 380 | | |
380 | 381 | | |
381 | 382 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1369 | 1369 | | |
1370 | 1370 | | |
1371 | 1371 | | |
1372 | | - | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
1373 | 1377 | | |
1374 | 1378 | | |
1375 | 1379 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
0 commit comments