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

reading DataFrame index as kdim or vdim in DataSet #2000

Closed
spott opened this Issue Oct 12, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@spott

spott commented Oct 12, 2017

If you try and pass in the name of an index as a kdim for a DataSet, then the DataSet should accept that and allow you to use an index as a kdim.

@jbednar

This comment has been minimized.

Member

jbednar commented Oct 12, 2017

If I understand you correctly, that should be working on the github master version of holoviews, as of #1946, and will be in the next release.

@jbednar

This comment has been minimized.

Member

jbednar commented Oct 12, 2017

Oops; didn't read your question closely enough; I thought you were focusing on using the column name rather than a list of column names, which is what the above PR does. Here, you're saying that we should treat the index as if it were a column. I really find it mystifying why Pandas treats the index so very differently from other columns, but yes, I agree, we should be able to pass the name of the index just like we can pass the name of regular columns. We would presumably have to do that as a special case, unfortunately. Meanwhile you can work around it using the Pandas .reset_index() method.

Your title suggests using the index as a vdim, not just a kdim, which seems unlikely to be useful because an index is clearly a key rather than a value dimension, but we'd probably have to explicitly disallow usage of the index as a vdim if we support it for kdim, so maybe the title is correct as written.

@spott

This comment has been minimized.

spott commented Oct 13, 2017

Your title suggests using the index as a vdim, not just a kdim, which seems unlikely to be useful because an index is clearly a key rather than a value dimension, but we'd probably have to explicitly disallow usage of the index as a vdim if we support it for kdim, so maybe the title is correct as written.

I agree... it would be very weird using the index as a vdim, but "weird" and "impossible" are different... and it seems weird to build code to explicitly disallow something just because it is weird.

We would presumably have to do that as a special case, unfortunately. Meanwhile you can work around it using the Pandas .reset_index() method.

I'm think that this reset_index() behavior can probably be done in order to reveal the index if it was asked for. It creates a shallow dataframe copy, so it shouldn't be user visible, and shouldn't be very expensive.

@philippjfr philippjfr removed the wishlist label Oct 17, 2017

@philippjfr philippjfr added this to the v1.10 milestone Dec 4, 2017

@philippjfr

This comment has been minimized.

Member

philippjfr commented Feb 5, 2018

Implemented now, see #2164.

@philippjfr philippjfr closed this Feb 5, 2018

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