Skip to content

Commit b786ce9

Browse files
committed
Added ability for objects to override how they show up in dataframe
1 parent 71074bf commit b786ce9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pandas/io/formats/printing.py

+4
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ def as_escaped_string(
216216

217217
if hasattr(thing, "__next__"):
218218
return str(thing)
219+
220+
if hasattr(thing, "__pandas_repr__"):
221+
return str(thing.__pandas_repr__())
222+
219223
elif isinstance(thing, dict) and _nest_lvl < get_option(
220224
"display.pprint_nest_depth"
221225
):

0 commit comments

Comments
 (0)