Tell us what’s happening:
I’m getting the same error all the time don’t know where I made a mistake, it’s seems to be some different values in the heatmap. The rest of the code it’s fine, at least, cero errors so far.
FAIL: test_heat_map_values (test_module.HeatMapTestCase)
Traceback (most recent call last):
File “/home/runner/boilerplate-medical-data-visualizer-1/test_module.py”, line 58, in test_heat_map_values
self.assertEqual(actual, expected, “Expected differnt values in heat map.”)
AssertionError: Lists differ: [‘0.0[389 chars]3’, ‘-0.0’, ‘0.0’, ‘-0.0’, ‘0.0’, ‘0.0’, ‘0.0’[217 chars]0.1’] != [‘0.0[389 chars]3’, ‘0.0’, ‘-0.0’, ‘0.0’, ‘-0.0’, ‘-0.0’, ‘-0.[218 chars]0.1’]
First differing element 55:
‘-0.0’
‘0.0’
Diff is 1034 characters long. Set self.maxDiff to None to see it. : Expected differnt values in heat map.
Your code so far
Draw Heat Map
def draw_heat_map():
# 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))
]
# Calculate the correlation matrix
corr = df_heat.corr()
# Generate a mask for the upper triangle
mask = np.zeros_like(corr)
mask[np.triu_indices_from(mask)] = True
# Set up the matplotlib figure
with sns.axes_style("white"):
fig, ax = plt.subplots(figsize=(7, 5))
# Draw the heatmap with 'sns.heatmap()'
ax = sns.heatmap(corr, mask=mask, vmax=1, square=True, annot=True, fmt=".1f")
# Do not modify the next two lines
fig.savefig('heatmap.png')
return fig
The error starts in the line with the number sign
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36
.
Challenge: Medical Data Visualizer
Link to the challenge: