Medical data Visualizer | First row not included in plot

I am having problems with the heatmap of the Medical Data Visualizer exercise, at Data Analysis certification. First row does not compute for the visualization:

The code that I used:

# Clean the data
    df_heat = df[(df['ap_lo'] <= df['ap_hi']) &
        (df['height'] >= df['height'].quantile(0.025)) &
        (df['height'] <= df['height'].quantile(0.975)) &
        (df['weight'] >= df['weight'].quantile(0.025)) &
        (df['weight'] <= df['weight'].quantile(0.975))]
    df_heat = df_heat.drop(columns='BMI')
    # Calculate the correlation matrix
    corr = df_heat.corr(method = "pearson")

    # Generate a mask for the upper triangle
    mask = np.triu(corr)

    # Set up the matplotlib figure
    fig, ax = plt.subplots(figsize=(12, 12))

    # Draw the heatmap with 'sns.heatmap()'
    fig = sns.heatmap(corr, linewidths = 1, annot = True, square = True, mask = mask, fmt = ".1f", center = 0.08, cbar_kws = {"shrink":0.5}).get_figure()
    # Do not modify the next two lines


It’s impossible to determine why the overweight row wasn’t included from this code since it only computes the heatmap and does not do the data cleaning and generation of the overweight data in the dataframe, which appears not to have happened correctly.

Post a link to the full code on or similar and you’ll be able to get more assistance.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.