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

improvement: handle pl.Duration #3274

Merged
merged 2 commits into from
Dec 23, 2024
Merged

improvement: handle pl.Duration #3274

merged 2 commits into from
Dec 23, 2024

Conversation

mscolnick
Copy link
Contributor

@mscolnick mscolnick commented Dec 21, 2024

Fixes #3267

This handles narwhals and polars Duration types, by treating them as floats and not temporal. We differ in the that we don't show the units for each entry (just at the top).

For pandas, we treat them as strings (with the same formatting as their plain HTML)

Screenshot 2024-12-21 at 2 02 30 PM Screenshot 2024-12-21 at 2 02 33 PM

Copy link

vercel bot commented Dec 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marimo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 23, 2024 3:20pm
marimo-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 23, 2024 3:20pm

Comment on lines 223 to 230
}
return ColumnSummary(
total=total,
nulls=col.null_count(),
min=str(unit_map["us"]().min()) + "μs",
max=str(unit_map["us"]().max()) + "μs",
mean=str(unit_map["us"]().mean()) + "μs",
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be worth factoring out the total_* call, so it doesn't get recalculated?

            duration = unit_map["us"]()
            return ColumnSummary(
                total=total,
                nulls=col.null_count(),
                min=str(duration.min()) + "μs",
                max=str(duration.max()) + "μs",
                mean=str(duration.mean()) + "μs",
            )

akshayka
akshayka previously approved these changes Dec 22, 2024
Copy link
Contributor

@akshayka akshayka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm modulo marco's comment

Copy link

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.10.7-dev27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support pl.Duration in dataframe viewer
3 participants