KitDocumentation

ColumnMax

Gets the maximum value of one or more columns. Furthermore, can get the maximum while being grouped by another column or category, perform a rolling maximum or sliding window maximum, can get the maximum for only rows that meet a condition, and can add the result to the dataframe as a new column

Options

columns: Specifies columns to calculate maximum values
where: Specifies a condition for the calculation
group: Groups the data before performing the operation
rolling: Specifies the rolling window overwhich to perform the calculation
addToDataframe: Indicates whether to add the result to the dataframe

Examples

Example 1 - Get Max of a Single Column

The maximum value in a column helps identify unusual or extreme entries. In this example, we compute the highest recorded TransactionAmount across all transactions.
#> ColumnMax TransactionAmount
AFLEFT 
banktransactionsDfMax = banktransactionsDf['TransactionAmount'].max() AFRIGHT

Example 2 - Get Max of Multiple Columns

This example shows how to retrieve the maximum values across several columns at once. It helps identify the oldest customer, the largest account balance, and the most recent transaction date in the dataset.
#> ColumnMax CustomerAge AccountBalance TransactionDate
AFLEFT 
banktransactionsDfMax = banktransactionsDf [ ['CustomerAge', 'AccountBalance', 'TransactionDate'] ].max() AFRIGHT

Example 3 - Add Rolling Max to Dataframe

A rolling maximum provides a dynamic upper bound across a defined window of rows. Here, we compute the maximum TransactionAmount across the latest 5 entries for each row and add that result as a new column for trend analysis.
#> ColumnMax --columns TransactionAmount --rolling 5 --addToDataframe
AFLEFT 
banktransactionsDfMaxRolling5 = banktransactionsDf['TransactionAmount'].rolling(window=5, min_periods=1).max()
banktransactionsDf['TransactionAmountMaxRolling5'] = pd.Series()
banktransactionsDf['TransactionAmountMaxRolling5'] = banktransactionsDfMaxRolling5 AFRIGHT