Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] No repr for pandas.Timestamp in JupyterLab when using rich.pretty #1305

Closed
dlukes opened this issue Jun 21, 2021 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@dlukes
Copy link

dlukes commented Jun 21, 2021

Describe the bug

In JupyterLab, after globally enabling rich reprs, no repr is shown for pandas.Timestamp objects. In both IPython and the default Python REPL, this problem does not occur.

To Reproduce

Start JupyterLab:

$ jupyter lab

Create a new notebook and enable rich reprs -- either like this:

%load_ext rich

Or like this:

from rich import pretty
pretty.install()

Then enter the following code into the next cell and evaluate it:

import pandas
pandas.Timestamp("2021-06-18T16:55:00")

No repr is shown. If the same code is run in a terminal REPL (both ipython and python), a repr is shown, as expected.

Platform

Linux (Solus)

Diagnose

$ pip freeze | grep -P '(rich|jupyterlab)='
jupyterlab==3.0.16
rich==10.4.0
@willmcgugan
Copy link
Collaborator

Found the problem. There will be a fix in the next release.

@willmcgugan willmcgugan added bug Something isn't working and removed Needs triage labels Jun 25, 2021
@willmcgugan
Copy link
Collaborator

Can you give 10.5.0 a try and let me know if that fixes it?

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jul 5, 2021
10.5.0:

Fixed

Fixed Pandas objects not pretty printing Textualize/rich#1305
Fixed Textualize/rich#1256
Fixed typing with rich.repr.auto decorator
Fixed repr error formatting Textualize/rich#1326

Added

Added new_line_start argument to Console.print
Added Segment.divide method
Added Segment.split_cells method
Added segment.SegmentLines class
@dlukes
Copy link
Author

dlukes commented Jul 5, 2021

It does indeed, thank you very much!

@dlukes dlukes closed this as completed Jul 5, 2021
@saiwing-yeung
Copy link

@willmcgugan I noticed an issue that might be related.

df = pd.DataFrame({'datadate': ['2021-01-01']})
df['datadate']  # doesn't print anything

This works if I don't pretty.install().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants