Skip to content

Commit

Permalink
Added ability for objects to override how they show up in dataframe
Browse files Browse the repository at this point in the history
  • Loading branch information
dalejung committed Sep 25, 2023
1 parent 1fcbaa9 commit 86ecf05
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pandas/io/formats/printing.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ def as_escaped_string(

if hasattr(thing, "__next__"):
return str(thing)

if hasattr(thing, "__pandas_repr__"):
return str(thing.__pandas_repr__())

elif isinstance(thing, dict) and _nest_lvl < get_option(
"display.pprint_nest_depth"
):
Expand Down

0 comments on commit 86ecf05

Please sign in to comment.