I recently started using apply
on my DataFrames
and Series
. It would be awesome to have this functionality on Index
objects. I usually have to rename my indices a lot.
D_obsv_meta = dict(of-label-mapping)
DF_raw.index.apply(lambda x: D_obsv_meta[x])
Comment From: jreback
its called map (on Series
) as well
In [3]: pd.Index(['foo', 'bar']).map(lambda x: {'foo':1, 'bar':2}[x])
Out[3]: array([1, 2], dtype=int64)