pola-rs / polars

Dataframes powered by a multithreaded, vectorized query engine, written in Rust
https://docs.pola.rs
Other
28.05k stars 1.72k forks source link

Prettify Series repr #10648

Open Julian-J-S opened 10 months ago

Julian-J-S commented 10 months ago

Problem description

Problem

Example

DATA = {'text': ['nospace', '     before', 'after     ', '     both     ', 'bet     ween',]}
df = pl.DataFrame(data=DATA)
ser = df.get_column('text')

image

Implementation

stevenlis commented 10 months ago

I prefer the vertical option you proposed above instead of a horizontal one.

Julian-J-S commented 10 months ago

I have no strong feeling abount vertical/horizontal but would actually prefer horizontal like @mcrumiller suggested here: https://github.com/pola-rs/polars/issues/10597#issuecomment-1687073987 Reasons:

stevenlis commented 10 months ago

I think space efficiency is contingent upon your screen ratio. I think what you have above makes more sense, but another option might be to simply put the values in a table.

# from this
shape: (3,)
Series: 'col' [i64]
[
    1
    2
    3
]

# to this?
shape: (3,)
Series: 'col' [i64]
╞═════╡
│ 1   │
│ 2   │
│ 3   │
└─────┘