Hello Team,
I am trying to set the bar height for a bar chart and I am using the code in Step 2 Mission 3 Page 4. I am working on Jupyter on my PC
import matplotlib.pyplot as plt
from numpy import arange
num_cols = ['RT_user_norm', 'Metacritic_user_nom', 'IMDB_norm', 'Fandango_Ratingvalue', 'Fandango_Stars']
bar_heights = norm_reviews[num_cols].iloc[0].values
bar_positions = arange(5) + 0.75
fig, ax = plt.subplots()
ax.bar(bar_positions, bar_heights, 0.5)
plt.show()
I get a TypeError message at line 4 of the code
"TypeError: list indices must be integers or slices, not list"
Kindly assist me in understanding the error.
Thanks,
Ignatius.
Bruno
October 11, 2019, 9:25am
#2
Hey, ignatiusebigwai .
I am unable to reproduce this. Can you please share your notebook so that other people can look into this?
It’s possible you’re doing something incorrect before this screen.
1 Like
Hi Bruno,
Thanks very much for your response.
Like you mentioned I was doing something wrong. I was working on more than one note book at the time and I had been practising for over 7hrs. Guess I was tired. But today I concentrated on the mission and it went smoothly. Apologies for the NPT I caused you.
Thanks,
Ignatius.
Bruno
October 11, 2019, 5:46pm
#4
No worries
Feel free to mark your own reply as a solution, just so that this question doesn’t appear to be unsolved.
Okay I have done that. Thanks.
1 Like