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

reading DataFrame index as kdim or vdim in DataSet #2000

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

reading DataFrame index as kdim or vdim in DataSet #2000

spott opened this issue Oct 12, 2017 · 4 comments
Assignees
Milestone

Comments

@spott
Copy link

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
Copy link
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
Copy link
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
Copy link
Author

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 added this to the v1.10 milestone Dec 4, 2017
@philippjfr
Copy link
Member

Implemented now, see #2164.

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

3 participants