INNER CODE UNIT · Python

reg_resid_plots

stefmolin/Hands-On-Data-Analysis-with-Pandas-2nd-edition · ch_06/viz.py:9

def reg_resid_plots(data):
    """
    Using `seaborn`, plot the regression and residuals plots
    side-by-side for every permutation of 2 columns in the data.
    
    Parameters:
        - data: A `pandas.DataFrame`

    Returns:
        A matplotlib `Axes` object.
    """
    num_cols = data.shape[1]
    permutation_count = num_cols * (num_cols - 1)

    fig, ax = plt.subplots(permutation_count, 2, figsize=(15, 8))

    for (x, y), axes, color in zip(
        itertools.permutations(data.columns, 2), 

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…