# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/Tutorials/05_missingness.ipynb.

# %% auto 0
__all__ = ['emptyColumns', 'emptyRows', 'emptyColumnsWithThreshold']

# %% ../nbs/Tutorials/05_missingness.ipynb 2
def emptyColumns(df:pd.DataFrame=None):
    """
    Returns a list of column names that have all NaN values.

    Args:
        df (pandas.DataFrame): The input DataFrame.

    Returns:
        list: A list of column names that have all NaN values.
    """
    # Get the column names where all values are NaN
    empty_cols = df.columns[df.isna().all()].tolist()
    return empty_cols

# %% ../nbs/Tutorials/05_missingness.ipynb 3
# return all empty rows
def emptyRows(df:pd.DataFrame=None):
    """
    Returns a list of row indices that have all NaN values.

    Args:
        df (pandas.DataFrame): The input DataFrame.

    Returns:
        list: A list of row indices that have all NaN values.
    """
    # Get the row indices where all values are NaN
    empty_rows = df.index[df.isna().all(axis=1)].tolist()
    return empty_rows


# %% ../nbs/Tutorials/05_missingness.ipynb 4
def emptyColumnsWithThreshold(df, threshold):
    """
    Returns a list of column names that have a percentage of NaN values greater than or equal to the specified threshold.

    Args:
        df (pandas.DataFrame): The input DataFrame.
        threshold (float): The minimum percentage of NaN values required (between 0 and 1).

    Returns:
        list: A list of column names that have a percentage of NaN values greater than or equal to the threshold.
    """
    # Calculate the percentage of NaN values for each column
    nan_percentages = (df.isna().sum() / len(df)) * 100
    # Get the column names where the percentage of NaN values is greater than or equal to the threshold
    columns_to_drop = nan_percentages[nan_percentages >= threshold].index.tolist()
    return columns_to_drop
