Hi all
i am trying to get the medical data visualizer done and am noticing an issue.
Basically, I am getting a 967 character difference (guess that is from rounding off) but a difference of -0.1 in one item of the correlation.
This is causing the failure that I am getting. The rest seems fine.
I am getting this error (difference is highlighted):
...['0.0', '0.0', '-0.0', '0.0', '-0.1', '0.5', '0.0', '0.1', '0.1', '0.3', '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '0.2', '0.1', '0.0', '0.2', '0.1', '0.0', '0.1', '-0.0', '-0.1', '0.1', '0.0', '0.2', '0.0', '0.1', '-0.0', '-0.0', '0.1', '0.0', '0.1', '0.4', '-0.0', '-0.0', '0.3', '0.2', '0.1', '-0.0', '0.0', '0.0', '-0.0', '-0.0', '-0.0', '0.2', '0.1', '0.1', '0.0', '0.0', '0.0', '0.0', '0.3', '0.0', '-0.0', '0.0', '-0.0', '-0.0', '-0.0', '0.0', '0.0', '-0.0', '0.0', '0.0', '0.0', '0.2', '0.0', '-0.0', '0.2', '0.1', '0.3', '0.2', '0.1', '-0.0', '-0.0', '-0.0', '-0.0', '0.1', '-0.1', '**-0.2'**, '0.7', '0.0', '0.2', '0.1', '0.1', '-0.0', '0.0', '-0.0', '0.1']
F
FAIL: test_heat_map_values (test_module.HeatMapTestCase)
Traceback (most recent call last):
File β/home/runner/boilerplate-medical-data-visualizer/test_module.pyβ, line 47, in test_heat_map_values
self.assertEqual(actual, expected, βExpected differnt values in heat map.β)
AssertionError: Lists differ: ['0.0[585 chars] β-0.2β, β0.7β, β0.0β, β0.2β, β0.1β, β0.1β, β-[22 chars]0.1β] != ['0.0[585 chars] β-0.1β, β0.7β, β0.0β, β0.2β, β0.1β, β0.1β, β-[22 chars]0.1β]
First differing element 81:
β-0.2β
β-0.1β
Diff is 967 characters long. Set self.maxDiff to None to see it. : Expected differnt values in heat map.
Ran 4 tests in 6.488s
FAILED (failures=1)
this is my code:
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.triu(corr)
# Set up the matplotlib figure
fig, ax = plt.subplots(figsize=(9,9))
# Draw the heatmap with 'sns.heatmap()'
sns.heatmap(corr,annot=True, fmt='.1f', linewidths=1, mask=mask, vmax=.8, center=0,square=True, cbar_kws = {'shrink':0.5})
thanks for anyone that can help and kind regards