edaflow.visualize_interactive_boxplots

edaflow.visualize_interactive_boxplots(df: DataFrame, columns: str | List[str] | None = None, title: str = 'Interactive Boxplot Analysis', height: int = 600, color_sequence: List[str] | None = None, show_points: str = 'outliers', verbose: bool = True) None[source]

Create interactive boxplots for numerical columns using Plotly Express.

This function provides an interactive alternative to matplotlib-based boxplots, allowing users to hover, zoom, and explore data distributions dynamically. Perfect for final visualization after data cleaning and outlier handling.

Parameters:
  • df (pd.DataFrame) – The input DataFrame

  • columns (Optional[Union[str, List[str]]], optional) – Column name(s) to visualize. If None, processes all numerical columns. Defaults to None.

  • title (str, optional) – Title for the interactive plot. Defaults to “Interactive Boxplot Analysis”.

  • height (int, optional) – Height of the plot in pixels. Defaults to 600.

  • color_sequence (Optional[List[str]], optional) – Custom color sequence for the boxplots. If None, uses Plotly’s default colors. Defaults to None.

  • show_points (str, optional) – Points to show on boxplots. Options: - “outliers”: Show only outlier points - “all”: Show all data points - “suspectedoutliers”: Show suspected outliers - False: Show no points Defaults to “outliers”.

  • verbose (bool, optional) – If True, displays detailed information about the visualization process. Defaults to True.

Returns:

Displays the interactive plot directly

Return type:

None

Raises:
  • ValueError – If no valid numerical columns are found.

  • KeyError – If specified column(s) don’t exist in the DataFrame.

  • ImportError – If plotly is not installed.

Example

>>> import pandas as pd
>>> import edaflow
>>>
>>> # Create sample data
>>> df = pd.DataFrame({
...     'age': [25, 30, 28, 35, 32, 29, 31, 33],
...     'income': [50000, 55000, 48000, 62000, 51000, 45000, 53000, 49000],
...     'score': [85, 90, 78, 92, 88, 95, 81, 87],
...     'category': ['A', 'B', 'A', 'C', 'B', 'A', 'C', 'B']
... })
>>>
>>> # Interactive visualization of all numerical columns
>>> edaflow.visualize_interactive_boxplots(df)
>>>
>>> # Visualize specific columns with custom styling
>>> edaflow.visualize_interactive_boxplots(
...     df,
...     columns=['age', 'income'],
...     title="Age and Income Distribution",
...     height=500,
...     show_points="all"
... )

# Alternative import style: >>> from edaflow.analysis import visualize_interactive_boxplots >>> visualize_interactive_boxplots(df, verbose=True)