Added ability for objects to override how they show up in dataframe · pandas-dev/pandas@86ecf05 (original) (raw)
Navigation Menu
- GitHub Copilot Write better code with AI
- GitHub Models New Manage and compare prompts
- GitHub Advanced Security Find and fix vulnerabilities
- Actions Automate any workflow
- Codespaces Instant dev environments
- Issues Plan and track work
- Code Review Manage code changes
- Discussions Collaborate outside of code
- Code Search Find more, search less
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit 86ecf05
Added ability for objects to override how they show up in dataframe
File tree
1 file changed
lines changed
1 file changed
lines changed
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -210,6 +210,10 @@ def as_escaped_string( | ||
210 | 210 | |
211 | 211 | if hasattr(thing, "__next__"): |
212 | 212 | return str(thing) |
213 | + | |
214 | +if hasattr(thing, "__pandas_repr__"): | |
215 | +return str(thing.__pandas_repr__()) | |
216 | + | |
213 | 217 | elif isinstance(thing, dict) and _nest_lvl < get_option( |
214 | 218 | "display.pprint_nest_depth" |
215 | 219 | ): |