googlecolab / colabtools

Python libraries for Google Colaboratory
Apache License 2.0
2.19k stars 720 forks source link

Performance Issue with Large Pandas Series or DataFrame Inline Display #4747

Open rk37 opened 3 months ago

rk37 commented 3 months ago

Describe the current behavior In recent versions of Colab, displaying a large Pandas Series object inline causes the current cell to run for an extended period without producing any output. If the object is large, the cell remains active for a long time, and the entire notebook becomes unresponsive, even though the interface does not freeze. This problem did not occur in previous versions.

Describe the expected behavior The large Pandas Series should display inline, showing only the head and tail, without causing the cell to run indefinitely and the notebook to become unresponsive.

What web browser you are using Any. Chrome and Firefox, etc.

Additional context colab_inline_display_performance_issue_for_large_pandas_object.ipynb

EvanWiederspan commented 3 months ago

Thanks for the report, we added a custom repr for Series recently that seems to be too slow for large Series. Tracking the fix internally at b/323408934, but in the meantime you can run the following to disable the slowness:

from google.colab import _reprs
_reprs.disable_pandas_series_repr()