-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat(python): Add a show
method to DataFrame and LazyFrame
#19634
base: main
Are you sure you want to change the base?
Conversation
No need to mock There are a few other options it would be nice to expose as well, such as I'd also change the parameter name Footnotes
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #19634 +/- ##
==========================================
- Coverage 79.88% 79.88% -0.01%
==========================================
Files 1593 1593
Lines 227649 227676 +27
Branches 2600 2607 +7
==========================================
+ Hits 181860 181880 +20
- Misses 45192 45198 +6
- Partials 597 598 +1 ☔ View full report in Codecov by Sentry. |
@alexander-beedie I've added all config options that impact the display format of a dataframe. I was thinking of hiding the dataframe shape by default because I find it a bit irrelevant when showing a dataframe, usually you would know what is the shape of the frame you are working with. But with the limitless option and for the sake of consistency I think I will leave it visible. |
afe59a5
to
c9653a5
Compare
Good stuff, will take a look.
Not necessarily - if it's wide (so cols are truncated in the repr) or you've just filtered the data you won't know the shape; definitely want to keep it 👍 |
@guilhem-dvr: the tests seem to show a few issues still to resolve. Looks like some state might be escaping (either from the function itself or, more likely, the tests?) 🤔 |
Somehow I was expecting this to be unrelated 😓 I will have a look. |
977e981
to
02d0bf1
Compare
I found the issue @alexander-beedie: decorating tests with Config was causing a config leak to other tests. I tried to replace the config decorators with calls to |
02d0bf1
to
aca552e
Compare
Hi @alexander-beedie, I think this PR is ready, would you care to have a look at it? |
show
method to DataFrame and LazyFrame
Apologies, lost track of this over the end of year crunch at work and Xmas break - will take a fresh look over it at the weekend, as I think this will be a nice addition 👌 |
Refactor both `show` methods to use a limit rather than a number of rows to show. The `limit` parameter is an extension of the `n` number of rows parameter, and can be set to None. In that case, the `show` method will display all frame rows.
aca552e
to
399ddb1
Compare
This adds a show method for both
DataFrame
andLazyFrame
objects, taking inspiration from pyspark's show method and taking into account the requirements from @stinodego in #16534.I choose to only expose config options that influence the result width's size, to mimic pyspark's
truncate
option.I've provided tests, but I'm not super satisfied with them: they could break when changing the default display options. I was thinking of mocking
Config
,print
anddisplay_html
, would that be okay?