holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.67k stars 400 forks source link

Pandas `observed=False` warnings #6313

Open maximlt opened 2 weeks ago

maximlt commented 2 weeks ago

The warnings:

[/Users/mliquet/dev/holoviews/holoviews/core/data/pandas.py:298](http://localhost:8889/Users/mliquet/dev/holoviews/holoviews/core/data/pandas.py#line=297): FutureWarning: The default of observed=False is deprecated and will be changed to True in a future version of pandas. Pass observed=False to retain current behavior or observed=True to adopt the future default and silence this warning.
  grouped = reindexed.groupby(cols, sort=False)
[/Users/mliquet/dev/holoviews/holoviews/element/util.py:203](http://localhost:8889/Users/mliquet/dev/holoviews/holoviews/element/util.py#line=202): FutureWarning: The default of observed=False is deprecated and will be changed to True in a future version of pandas. Pass observed=False to retain current behavior or observed=True to adopt the future default and silence this warning.
  df = obj.data.set_index(index_cols).groupby(index_cols, sort=False).first()
import holoviews as hv
import numpy as np
import pandas as pd

hv.extension('bokeh')

df = pd.DataFrame({
    'X': pd.Series(['a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c',], dtype='category'),
    'Y': pd.Series(['O', 'P', 'Q', 'O', 'P', 'Q', 'O', 'P', 'Q',], dtype='category'),
    'Z': [1, 2, 3, 4, 5, 6, 7, 8, 9],
})

hv.HeatMap(df, ['X', 'Y'], 'Z').aggregate(function=np.mean)

image