Not sure if it's always been this way or if refactoring broke something.
In any case it looks strange when in ipnb:
related to #5550, making reprs consistent.
Comment From: jtratner
It's always been that way.
Comment From: ghost
Thought so, it's surprising users haven't flagged this earlier then.
Comment From: lexual
https://github.com/pydata/pandas/pull/10300
Comment From: smcinerney
WORKAROUND: Series.to_frame()
e.g. df.isnull().sum().to_frame()
Comment From: ankostis
Series should have a different output from Frames. See https://github.com/pandas-dev/pandas/pull/10300#issuecomment-252669545
Comment From: smcinerney
I guess we can't distinguish between a plain dataframe Series e.g. produced by a slice, and a "table-like" series produced by a function like df.isnull().sum()
, where the row-indices are actually column names of the df? The latter is really a table in disguise. pandas does this a lot.
Comment From: TomAugspurger
FWIW, I think DataFrames having the column names above, and Series having the name below (perhaps as a caption) should be visually distinct enough.
Comment From: big-o
I've taken an initial stab at this. It's my first contribution to the project so it's probably pretty messy and will need some further work, but if it's the sort of thing you're after and can point me in the right direction of what extra bits are needed then I'm happy to do it.
Here's my fork: https://github.com/big-o/pandas. I haven't submitted a PR yet because it needs unit tests and I don't want to start on that until I'm certain that I'm on the right track functionality-wise.
It doesn't quite support everything that DataFrame.to_html() does (justify and sparsify options aren't implemented) but it hopefully covers the most important bits.
Here's a few screenshots:
Comment From: jreback
would be easier to review as a PR (then we can comment directly on the impl); you can add tests later
Comment From: big-o
would be easier to review as a PR (then we can comment directly on the impl); you can add tests later
Done!