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

to_html: sparsify mutliindex keys in dataframe rows #1929

Closed
btel opened this issue Sep 18, 2012 · 1 comment
Closed

to_html: sparsify mutliindex keys in dataframe rows #1929

btel opened this issue Sep 18, 2012 · 1 comment
Labels
Enhancement Output-Formatting __repr__ of pandas objects, to_string
Milestone

Comments

@btel
Copy link

btel commented Sep 18, 2012

The sparsify option of DataFrame.to_html currently works only for columns. It would be useful to add this option also for rows, similarly to what is already done for data frame representation in console.

Example:

df = pd.DataFrame(np.arange(3), index=[['X', 'X', 'Y'], ['a','b','a']])
df.to_html(fid)

currently produces the following output:

0
X a 0
X b 1
Y a 2

This should be changed to:

0
X a 0
b 1
Y a 2
@wesm wesm closed this as completed in d99a119 Sep 18, 2012
@wesm
Copy link
Member

wesm commented Sep 18, 2012

Looking pretty good now:

exp A B C
first second
foo one -1.159321 -0.131931 0.818024
two -1.318878 0.285172 0.551480
three 0.340577 0.376841 0.050759
bar one 1.300129 -1.733227 -0.746667
two 0.178495 -0.286725 0.011206
baz two 0.764214 0.702831 0.080559
three -0.299611 -0.505831 -0.319067
qux one -0.413753 1.213659 -0.234424
two -1.029432 -1.984151 -0.047421
three 0.645149 -0.683223 -0.544720

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

No branches or pull requests

2 participants