lisa.datautils.series_dereference#

lisa.datautils.series_dereference(series, sources, inplace=False, method='ffill')[source]#

Replace each value in series by the value at the corresponding index by the source indicated by series’s value.

Parameters:
  • series (pandas.Series) – Series of “pointer” values.

  • sources (collections.abc.Mapping or pandas.DataFrame) –

    Dictionary with keys corresponding to series values. For each value of series, a source will be chosen and its value at the current index will be used. If a pandas.DataFrame is passed, the column names will be used as keys and the column series as values.

    Note

    Unless series and the sources share the same index, the sources will be reindexed with ffill method.

  • inplace (bool) – If True, modify the series inplace.

  • method (str) – sources is reindexed so that it shares the same index as series. method is forwarded to pandas.Series.reindex().