data.py#

mlui.tools.data.parse_csv(csv_str)[source]#

Parse the delimiter of a CSV string and check for a header.

Parameters:

csv_str (str) – CSV string to be parsed.

Returns:

Identified delimiter.

Return type:

str

Raises:

ParseCSVError – If the delimiter or header cannot be determined. If the delimiter is not one of ‘,’ or ‘;’.

mlui.tools.data.validate_df(df)[source]#

Validate the structure of a DataFrame.

Parameters:

df (DataFrame) – DataFrame to be validated.

Raises:

ValidateDataError – If the index of the DataFrame is an instance of MultiIndex. If the DataFrame contains less than 2 columns. If the DataFrame contains less than 2 rows.

mlui.tools.data.contains_nans(df)[source]#

Check if a DataFrame contains any NaN values.

Parameters:

df (DataFrame) – DataFrame to be checked.

Returns:

True if there are NaN values, False otherwise.

Return type:

bool

mlui.tools.data.contains_nonnumeric_dtypes(df)[source]#

Check if a DataFrame contains columns with non-numeric data types.

Parameters:

df (DataFrame) – DataFrame to be checked.

Returns:

True if there are non-numeric data types, False otherwise.

Return type:

bool