Data Analysis with Python Projects - Medical Data Visualizer

Tell us what’s happening:
Getting the same error that many others have gotten:

AssertionError: Lists differ: ['0.0[141 chars]1', '-0.0', '0.0', '-0.0', '-0.0', '0.1', '0.0[467 chars]0.1'] != ['0.0[141 chars]1', '0.0', '0.1', '-0.0', '-0.1', '0.1', '0.0'[466 chars]0.1']

First differing element 21:

Diff is 1099 characters long. Set self.maxDiff to None to see it. : Expected different values in heat map.

It seems to be an issue with filtering or formatting, but I have gone through the seaborn docs and can’t seem to find an answer. Any help would be greatly appreciated!

Your code so far

def draw_heat_map():

    # Clean the data
	df_heat = df.loc[
		# diastolic pressure is higher than systolic
		(df['ap_lo'] <= df['ap_hi']) & 

		# height is less than the 2.5th percentile
		(df['height'] >= df['height'].quantile(0.025)) & 

		# height is more than the 97.5th percentile
		(df['height'] <= df['height'].quantile(0.975)) & 

		# weight is less than the 2.5th percentile
		(df['weight'] >= df['weight'].quantile(0.025)) & 

		# weight is more than the 97.5th percentile
		(df['weight'] <= df['weight'].quantile(0.975))

    # Calculate the correlation matrix
	corr = df_heat.drop(columns=['BMI']).corr()

    # Set up the figure and the axis
	fig, ax = plt.subplots(figsize=(10, 8))

	# Create the heatmap with a masked upper triangle
		cmap=sns.diverging_palette(20, 220, n=200), 
		mask=np.triu(np.ones_like(corr, dtype=bool)), 
		center = 0,
			"shrink": .5, 
			"ticks":[-0.08, 0.00, 0.08, 0.16, 0.24]

    # Do not modify the next two lines
	return fig

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Data Analysis with Python Projects - Medical Data Visualizer

Link to the challenge:

You can try this from the error message to see if you can get some more information about the error.

I’m unable to replicate the problem from just your heatmap code so the problem may lie in the data cleaning or elsewhere. You’ll need to post a link to your repl (preferable) or post all your code to debug.