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

Incorrect DeprecationWarning: Having a non-string as a column name in a DataFrame #933

Closed
2-5 opened this issue Oct 12, 2022 · 4 comments
Closed
Labels
type: upstream Anything that requires work outside hvPlot

Comments

@2-5
Copy link

2-5 commented Oct 12, 2022

ALL software version info

python-3.10.4
holoviews-1.15.1
hvplot-0.8.1
panel-0.14.0
pandas-1.5.0
VS Code 1.72.1
Jupyter Extension v2022.9.1202862440
Windows 10

Description of expected behavior and the observed behavior

A DeprecationWarning is raised, but it seems it should not:

DeprecationWarning: Having a non-string as a column name in a DataFrame is deprecated and will not be supported in Holoviews version 1.16.

Complete, minimal, self-contained example code that reproduces the issue

import pandas as pd
import hvplot.pandas

data = [["a", 1], ["b", 2], ["c", 3]]

df = pd.DataFrame(data, columns=["x", "y"])
df.hvplot()

Screenshots or screencasts of the bug in action

2022-10-12_201227

@2-5
Copy link
Author

2-5 commented Oct 12, 2022

It seems the cause is that holoviews wraps DataFrame columns in Dimension, and the code which throws the warning strictly checks against str, and doesn't handle Dimension columns.

@hoxbro
Copy link
Member

hoxbro commented Oct 12, 2022

Yes. This should be fixed when this holoviz/holoviews#5470 is merged.

Curious about why you see the warning in your notebook. Do you have any custom settings enabled?

@2-5
Copy link
Author

2-5 commented Oct 12, 2022

I have this env variable set: PYTHONWARNINGS=default. Due to it I often see deprecation warnings in various projects. Maybe it would be a good idea if at least some holoviz devs would also enable it on their dev machines.

https://docs.python.org/3/library/warnings.html#updating-code-for-new-versions-of-dependencies

@maximlt maximlt added the type: upstream Anything that requires work outside hvPlot label Oct 13, 2022
@maximlt
Copy link
Member

maximlt commented Oct 13, 2022

Thanks @2-5, for the PYTHONWARNINGS=default trick and for reporting this issue, we have indeed missed the Dimension case in the warning that is emitted, this is going to be fixed in the next release of HoloViews.

@hoxbro hoxbro closed this as completed Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: upstream Anything that requires work outside hvPlot
Projects
None yet
Development

No branches or pull requests

3 participants