Skip to content Skip to sidebar Skip to footer

Pandas Panel Is Deprecated,

This code snippet is from one of my script which works fine in current panda version (0.23) but Panel is deprecated and will be removed in a future version. panel = pd.Panel(dict(d

Solution 1:

import xarray as xr
a = pd.DataFrame({'a':[1,2,3],'b':[4,5,6],'c':[7,8,9]})
b = pd.DataFrame({'a':[11,12,13],'b':[14,15,16],'c':[17,18,19]})
ds = xr.Dataset({1:a, 2:b})
def f(thing):
    #print(thing)
    return thing.mean()
>>> q = ds.apply(f)
>>> q
<xarray.Dataset>
Dimensions:  ()
Data variables:
    1        float64 5.0
    2        float64 15.0
>>> q[1]
<xarray.DataArray 1 ()>
array(5.)
>>> q[1].values
array(5.)

Post a Comment for "Pandas Panel Is Deprecated,"