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

Showing Pandas DataFrame crashes marimo #339

Closed
noeleont opened this issue Nov 13, 2023 · 4 comments · Fixed by #341
Closed

Showing Pandas DataFrame crashes marimo #339

noeleont opened this issue Nov 13, 2023 · 4 comments · Fixed by #341
Labels
bug Something isn't working

Comments

@noeleont
Copy link

noeleont commented Nov 13, 2023

Describe the bug

When I display a DataFrame with a lot of rows, e.g. California housing dataset directly, marimo is getting really unresponsive.

I would expect to add a pagination or show the first and last few rows (like Jupyter does).

If you can point me in the right direction, I'm happy to help!

Version

0.1.47

Code to reproduce

import marimo
 
__generated_with = "0.1.47"
app = marimo.App()
 
 
@app.cell
def __():
    from sklearn.datasets import fetch_california_housing
    return fetch_california_housing,
 
 
@app.cell
def __(fetch_california_housing):
    data = fetch_california_housing(as_frame=True)
    return data,
 
 
@app.cell
def __(data):
    data.get("data")
    return
@noeleont noeleont added the bug Something isn't working label Nov 13, 2023
@akshayka
Copy link
Contributor

@noeleont, thanks for reporting!

The code for how dataframes are formatted is here: https://github.com/marimo-team/marimo/blob/main/marimo/_output/formatters/pandas_formatters.py#L21-L27

You'll see we just call df.to_html().

I like your suggestion to truncate or show the head/tail only for sufficiently large dataframes. If you'd like you're more than welcome to make a PR, otherwise I'm happy to do it!

@noeleont
Copy link
Author

@akshayka, thanks for your fast response :)

@akshayka
Copy link
Contributor

@akshayka, thanks for your fast response :)

No problem! Really appreciate the bug report.

PR #341 implements showing just the first and last few rows of dataframes, similar to what Jupyter does. Will release it later today (unless you have any objections)!

@akshayka
Copy link
Contributor

@noeleont, v0.1.49 was just released including the fix. Feel free to re-open if you still have an issue!

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

Successfully merging a pull request may close this issue.

2 participants