maxframe.liteframe.LiteFrame.replace#

LiteFrame.replace(to_replace=None, value=None)#

Replace values in the LiteFrame.

When to_replace is None, behaves like fillna (replaces only NA/null values). When to_replace is a scalar, replaces all occurrences of that value with value across every column.

Parameters:
  • to_replace (scalar, optional) – Value to replace. When None (the default), only NA/null values are replaced, behaving like fillna(). Only scalar to_replace is supported.

  • value (scalar, optional) – Replacement value used in place of to_replace (or in place of NA when to_replace is None).

Returns:

LiteFrame with matching values replaced.

Return type:

LiteFrame

See also

fillna

Fill missing values.

where

Replace values where a condition is False.

Examples

>>> import maxframe.liteframe as mlf
>>> lf = mlf.LiteFrame({'a': [1, 2, 1], 'b': [1, 1, 2]})
>>> result = lf.replace(1, 99)
>>> result.execute()
     a    b
0  99  99
1   2  99
2  99   2