Commit f9b5d08
authored
Fix exceptions in
Correction for handling for Pandas and Polars DataFrame and Series types
for the %whos magic command. This small change reverts the most recent
changes to **namespace.py**, and relative to IPython version 8.26.0
(from my Python 3.12 install), simply adds a two-line **elif** clause to
specifically handle the case of **DataFrame** and **Series** types, as
found in Pandas and Polars. The existing code looks too generally for
variables with 'shape' and '\_\_len\_\_' attributes, which
unintentionally catches some modules and other items, and causes
exceptions. It also unintentionally hijacks correct 'default' handling
of strings and other types.
The change here is focused directly and only on the **DataFrame** and
**Series** types, and if found, shows their shape attribute. Processing
of all other types is left unchanged from 8.26.0.
Please see discussion at Issue #14952.
Note, this is my first real GitHub pull request, so please let me know
if I've done anything incorrectly, or left out any steps, as I would
like to learn from this experience!whos magic command (#14970)2 files changed
+50
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
365 | | - | |
| 364 | + | |
366 | 365 | | |
367 | 366 | | |
368 | 367 | | |
| |||
450 | 449 | | |
451 | 450 | | |
452 | 451 | | |
453 | | - | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
454 | 455 | | |
455 | 456 | | |
456 | 457 | | |
| |||
463 | 464 | | |
464 | 465 | | |
465 | 466 | | |
466 | | - | |
| 467 | + | |
467 | 468 | | |
468 | 469 | | |
469 | | - | |
| 470 | + | |
470 | 471 | | |
471 | 472 | | |
472 | 473 | | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | 474 | | |
477 | 475 | | |
478 | 476 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
768 | 769 | | |
769 | 770 | | |
770 | 771 | | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
771 | 815 | | |
772 | 816 | | |
773 | 817 | | |
| |||
0 commit comments