edaflow.check_null_columns
- edaflow.check_null_columns(df: DataFrame, threshold: float | None = 10) DataFrame[source]
Check null values in DataFrame columns with rich styled output.
Calculates the percentage of null values per column and applies color styling based on the percentage of nulls relative to the threshold.
- Parameters:
df (pd.DataFrame) – The input DataFrame to analyze
threshold (Optional[float], optional) – The threshold percentage for highlighting. Defaults to 10.
- Returns:
- A styled DataFrame showing column names and null
percentages with color coding: - Red: > 2*threshold (high null percentage) - Yellow: > threshold but <= 2*threshold (medium null %) - Light yellow: > 0 but <= threshold (low null %) - Gray: 0 (no nulls)
- Return type:
pd.DataFrame
Example
>>> import pandas as pd >>> import edaflow >>> df = pd.DataFrame({'A': [1, 2, None], 'B': [1, None, None]}) >>> styled_result = edaflow.check_null_columns(df, threshold=20) >>> # Returns styled DataFrame with null percentages
# Alternative import style: >>> from edaflow.analysis import check_null_columns >>> styled_result = check_null_columns(df, threshold=20)