Scalar transforms applied independently to each element —
mirrors pandas.Series.clip(), .abs(), and
.round().
Edit any code block below and press ▶ Run
(or Ctrl+Enter) to execute it live in your browser.
clip(series, { lower, upper }) replaces any value below
lower with lower, and any value above
upper with upper. Pass only one bound to clip
from one side only. Mirrors pandas.Series.clip().
dataFrameClip(df, { lower, upper }) applies the same clipping
to every numeric column. Mirrors pandas.DataFrame.clip().
seriesAbs(series) returns a new Series where every element is
replaced by its absolute value. Mirrors
pandas.Series.abs().
dataFrameAbs(df) applies abs() column-by-column.
Mirrors pandas.DataFrame.abs().
seriesRound(series, { decimals }) rounds each value to the given
number of decimal places (default 0). Negative decimals rounds
to the left of the decimal point (e.g. -1 rounds to the nearest
10). Mirrors pandas.Series.round().
dataFrameRound(df, { decimals }) rounds every numeric column of
a DataFrame. Mirrors pandas.DataFrame.round().
All three operations propagate null and NaN
unchanged — consistent with pandas' behaviour.
All element-wise operations return new Series/DataFrame instances — the
originals are never mutated. Missing values (null,
NaN) pass through unchanged.
// Series clip
clip(series, {
lower?: number, // minimum bound (default: -Infinity)
upper?: number, // maximum bound (default: +Infinity)
}): Series<number>
// DataFrame clip
dataFrameClip(df, { lower?, upper? }): DataFrame
// Series absolute value
seriesAbs(series): Series<number>
// DataFrame absolute value
dataFrameAbs(df): DataFrame
// Series round
seriesRound(series, {
decimals?: number, // default 0 — negative rounds left of decimal
}): Series<number>
// DataFrame round
dataFrameRound(df, { decimals? }): DataFrame