Skip to content

Colfunctions

flowtask.events.events.alerts.colfunctions

average

average(df, desc, column_name, threshold, deviation=2, allow_below=False, allow_above=False)

average.

Parameters:

Name Type Description Default
df DataFrame

Dataframe.

required
desc Any

Description of the DataFrame.

required
colname str

Column Name.

required
threshold Union[int, float]

Threshold value.

required
deviation Union[int, float]

percent of deviation from the threshold

2
allow_below bool

how many percent below the threshold is allowed

False
allow_above bool

how many percent above the threshold is allowed

False

Returns:

Type Description
tuple

between

between(df, desc, column_name, values)

Check if the values in a DataFrame column are between the given min and max values.

Args: - df (pd.DataFrame): The DataFrame to check. - desc (Any): The description (usually from df.describe()) of the DataFrame. - column_name (str): The name of the column to check. - values (tuple): A tuple containing the (min, max) values.

column_size

column_size(df, desc, column_name, min_length, max_length)

Check if all values in a string column have lengths within the specified range.

Parameters:

Name Type Description Default
df DataFrame

The DataFrame to check.

required
desc Any

Ignored, used for compatibility.

required
column_name str

The name of the column to check.

required
min_length int

The minimum length allowed for strings.

required
max_length int

The maximum length allowed for strings.

required

Returns:

Name Type Description
tuple tuple

(column_name, min_length, max_length, True/False)

count_nulls

count_nulls(df, desc, column_name, value)

Check if the number of non-null values in a column is greater than a given threshold.

Parameters:

Name Type Description Default
- df (pd.DataFrame

The DataFrame to check.

required
- desc (Any

The description (usually from df.describe()) of the DataFrame.

required
- column_name (str

The name of the column to check.

required
- min_length (int

The minimum number of non-null values required.

required

Returns:

Name Type Description
tuple tuple

(min_length, True/False)

equal

equal(df, desc, column_name, values)

Check if all values in a DataFrame column are within the provided list of strings.

Args: - df (pd.DataFrame): The DataFrame to check. - desc (Any): The description (usually from df.describe()) of the DataFrame. - column_name (str): The name of the column to check. - values (tuple): A tuple containing the allowed strings.

not_null

not_null(df, desc, column_name)

Check if a DataFrame column contains only non-null values.

Parameters:

Name Type Description Default
- df (pd.DataFrame

The DataFrame to check.

required
- desc (Any

The description (usually from df.describe()) of the DataFrame.

required
- column_name (str

The name of the column to check.

required

Returns:

Name Type Description
tuple

(column_name, True/False)