Open dwr-psandhu opened 1 year ago
Workaround is the rename index.
Hi @dwr-psandhu and thanks for this bug report.
Pandas indeed allows to have an index named with an integer value, and probably some other types too. Yet we generally recommend using string types for the index and columns names.
I had a quick look at this issue, there seems to be two problems. First in the following lines when x = 0
the condition is true, because 0
is interpreted as false by Python.
1552 if not x and not categories:
-> 1553 raise ValueError('Could not determine what to plot. Set x explicitly')
But that wouldn't be enough, as 0
would be passed down to HoloViews as a dimension name, HoloViews would then raise an error as it only accepts string dimension names. We've already had to work around that for Pandas columns, I guess it's an oversight not to have applied the same workaround to the index. So the second part of the fix would I think be to extend the _transform_columnar_data
method in the converter.py
module to also cast the index names to strings.
ALL software version info
hvplot 0.8.1
Description of expected behavior and the observed behavior
a DataFrame has a index named 0 ( the int type). This is allowed i guess
Complete, minimal, self-contained example code that reproduces the issue
Stack traceback and/or browser JavaScript console output