Skip to content

DataStream.max

Return the maximum values of the specified columns.

Parameters:

Name Type Description Default
columns str or list

the column name or a list of column names.

required
collect bool

if True, return a Polars DataFrame. If False, return a Quokka DataStream.

True
Source code in pyquokka/datastream.py
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
def max(self, columns, collect = True):

    """
    Return the maximum values of the specified columns.

    Args:
        columns (str or list): the column name or a list of column names.
        collect (bool): if True, return a Polars DataFrame. If False, return a Quokka DataStream.
    """

    assert type(columns) == str or type(columns) == list
    if type(columns) == str:
        columns = [columns]
    for col in columns:
        assert col in self.schema

    if collect:
        return self.agg({col: "max" for col in columns}).collect()
    else:
        return self.agg({col: "max" for col in columns})