Skip to content

Show a multi-indexed column #18

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

Open
garaud opened this issue Apr 29, 2015 · 6 comments
Open

Show a multi-indexed column #18

garaud opened this issue Apr 29, 2015 · 6 comments

Comments

@garaud
Copy link

garaud commented Apr 29, 2015

Hi,

Is it possible to show a DataFrame where the columns are a MultiIndex such as:

          A                             C                    
          1         2         3         1         2         3
X -0.890096  0.076550 -0.686891  0.985743 -0.426691 -0.577464
Y -1.059743 -2.835858 -0.389842 -0.316724  0.102168 -0.932888

Thanks,
Damien G.

@davemt
Copy link

davemt commented Oct 19, 2015

I had an issue getting this to work as well. I am seeing a JS error:

SyntaxError: Unexpected identifier

One temporary workaround until there is a proper fix is to flatten the columns as follows:

df.columns = [' '.join(col).strip() for col in df.columns.values]

http://stackoverflow.com/a/14508355

@TimShawver
Copy link
Contributor

Currently our code attempts to flatten any multi index columns, so no it's not currently possible. Adding better support for multi index columns would be a nice enhancement though.

@djinnome
Copy link

Any progress on this front? It would be really helpful to interactively explore multi-index data frames. It is the main limitation to qgrid that I have found so far.

@TimShawver
Copy link
Contributor

Sorry, no progress on this yet (as mentioned in the dup issue). I did some investigation today but this is not yet at the top of my qgrid work queue (I have a couple of other PRs to finish up first).

@djinnome
Copy link

djinnome commented Jun 9, 2018

Thanks for letting me know. I look forward to beautiful, multi-indexed qgrid columns in the future. In the meantime, this is a reasonable workaround:

from IPython.display import HTML
HTML(df.to_html())

@alexander-titov
Copy link

Hi,

Currently our code attempts to flatten any multi index columns, so no it's not currently possible.

Is it true? I am using 1.1.1 version and there is not auto flattening.

Can you please add qrgid option for that?

Example:

import pandas
import qgrid
qgrid.show_grid(pandas.DataFrame([[0, 1], [2, 3]], index=[['a', 'a'], ['a1', 'a2']]).T)

Result:

NotImplementedError: orient='table' is not supported for MultiIndex

Requested result (if the proper qgrid option is enabled):

The exact separator (comma in the example above) can be also defined via qgrid option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants