Error while running code: https://fcc-medical-data-visualizer-2.richakundan.repl.run

Tell us what’s happening:

While running the code for medical data visualizer following error is occuring:
Repl.it: Updating package configuration

–> python3 -m poetry lock

[RuntimeError]
The Poetry configuration is invalid:

  • ‘description’ is a required property

exit status 1

Repl.it: Package operation failed.

Your code so far

        import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np

# Import data
df = df = pd.read_csv("medical_examination.csv")

# Add 'overweight' column
df['overweight'] = df['overweight'] = (df['weight'] / (df['height'] / 100) ** 2) > 25

# Normalize data by making 0 always good and 1 always bad. If the value of 'cholestorol' or 'gluc' is 1, make the value 0. If the value is more than 1, make the value 1.
medical_dict = { 1: 0, 2 : 1, 3: 1}
df['cholesterol'] = df['cholesterol'].map( medical_dict )
df['gluc'] = df['gluc'].map( medical_dict ) 

# Draw Categorical Plot
def draw_cat_plot():
    # Create DataFrame for cat plot using `pd.melt` using just the values from 'cholesterol', 'gluc', 'smoke', 'alco', 'active', and 'overweight'.
    df_cat = df_cat=pd.DataFrame(df)
    df_cat = pd.melt(df, value_vars=['cholesterol', 'gluc', 'smoke', 'alco', 'active', 'overweight'], 
      id_vars=['cardio'])


    # Group and reformat the data to split it by 'cardio'. Show the counts of each feature. You will have to rename one of the collumns for the catplot to work correctly.
    df_cat = df_cat = pd.DataFrame(
      df_cat.groupby(
          ['variable', 'value', 'cardio'])['value'].count()).rename(
          columns={'value': 'total'}).reset_index()

    # Draw the catplot with 'sns.catplot()'
    sns.catplot(x='variable', y='total', hue='value', 
              col='cardio', data=df_cat, kind='bar')

    plt.savefig('catplot.png')
    plt.gcf()


    # Do not modify the next two lines
    fig.savefig('catplot.png')
    return fig


# Draw Heat Map
def draw_heat_map():
    # Clean the data
    df_heat = df_heat = pd.DataFrame(df)
    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))]

    # Calculate the correlation matrix
    corr = df_heat.corr()

    # Generate a mask for the upper triangle
    mask = mask = np.zeros_like(corr, dtype=np.bool)
    mask[np.triu_indices_from(mask)] = True



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

    # Draw the heatmap with 'sns.heatmap()'
    sns.heatmap(corr,annot=True, mask = mask,fmt='.1f', vmax=.3, center=0,
              square=True, linewidths=.5, cbar_kws={"shrink": .5})


    # Do not modify the next two lines
    fig.savefig('heatmap.png')
    return fig

Your browser information:

https://fcc-medical-data-visualizer-2.richakundan.repl.run.

Challenge: Medical Data Visualizer

Link to the challenge:

In pyproject.toml file, in the section [tool.poetry] add the following line:

description = ""

Welcome, kundan.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like

Thanks for the guidance. I will keep this in mind.