maxframe.liteframe.LiteFrame.clip#

LiteFrame.clip(lower=None, upper=None)#

Trim values at input threshold(s).

Values below lower are set to lower; values above upper are set to upper. At least one of lower / upper must be provided.

Parameters:
  • lower (scalar or LiteFrame, optional) – Minimum threshold. A LiteFrame must derive from the same source as lf (per-column bounds are matched by column name); a scalar is broadcast to every column.

  • upper (scalar or LiteFrame, optional) – Maximum threshold. Same rules as lower.

Returns:

A new LiteFrame with clipped values.

Return type:

LiteFrame

See also

where

Replace values where a condition is False.

between

Return boolean LiteFrame for values within a range.

Examples

>>> import maxframe.liteframe as mlf
>>> lf = mlf.LiteFrame({'a': [1, 2, 3, 4, 5]})
>>> result = lf.clip(2, 4)
>>> result.execute()
   a
0  2
1  2
2  3
3  4
4  4