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

Add pl.Config.show_full (or something similar) #16587

Open
mcrumiller opened this issue May 29, 2024 · 2 comments
Open

Add pl.Config.show_full (or something similar) #16587

mcrumiller opened this issue May 29, 2024 · 2 comments
Labels
enhancement New feature or an improvement of an existing feature

Comments

@mcrumiller
Copy link
Contributor

mcrumiller commented May 29, 2024

Description

Sometimes you may want to simply print an entire table, and see everything, with no truncation anywhere. Sometimes you may want the string representation of the full table, no matter how big it is.

Right now, we can manually set the fmt_str_lengths to 999999 and tbl_rows/tbl_cols to 99999, but I always have to go back to the API to look up what the actual names are, since some words like "fmt" and "str" are abbreviated but others like "lengths" are not. It would be very nice to have a single configuration option to print the full table.

This does open the door for floating point questions and really long lists, so some feedback on this idea would be welcome.

@mcrumiller mcrumiller added the enhancement New feature or an improvement of an existing feature label May 29, 2024
@cmdlineluser
Copy link
Contributor

Just on the point of printing larger lists, it reminds me of the request for an equivalent to pandas display.expand_frame_repr option: #7665

import polars as pl
import pandas as pd

df = pl.DataFrame({
    "A": [ list(range(20)) for _ in range(5) ],
    "B": range(5),
    "C": [ "foo" * 20 for _ in range(5) ]
})

with pd.option_context(
    "display.expand_frame_repr", True,
    "display.max_columns", None,
    "display.max_rows", None,
    "display.max_colwidth", None,
): 
    print(df.to_pandas())
                                                                        A  B  \
0  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]  0   
1  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]  1   
2  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]  2   
3  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]  3   
4  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]  4   

                                                              C  
0  foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo  
1  foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo  
2  foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo  
3  foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo  
4  foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo  

.glimpse() was previously suggested to me - which is useful, but (for me) can be a bit harder to read for longer data:

df.glimpse(max_items_per_column=-1) 
Rows: 5
Columns: 3
$ A <list[i64]> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
$ B       <i64> 0, 1, 2, 3
$ C       <str> 'foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo', 'foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo', 'foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo', 'foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo'

@evbo
Copy link

evbo commented Jul 10, 2024

It would be awesome if both Rust and Python had a way of simply printing everything.

I'd take df.glimpse(GlimpseArgs{expand_all: true, ..Default::default()}) any day

Even if it's extremely poor performance - I think it goes without saying this feature is only for desperate debugging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants