user4591642
user4591642

Reputation:

AttributeError: 'module' object has no attribute 'hist'

I'm new to Python (and am using Spyder) and am trying to create some histograms of when the top movies from IMDB were created. I have imported the matplotlib, numpy and pandas, as well as the .txt file, but when I run the following lines of code:

plt.hist(data.year, bins=np.arange(1950, 2013), color='#cccccc')

I receive an error message:

Traceback (most recent call last):
  File "stdin", line 1, in <module>
AttributeError: 'module' object has no attribute 'hist'

What am I doing wrong?

Upvotes: 2

Views: 31542

Answers (1)

Piotr Dajlido
Piotr Dajlido

Reputation: 2030

Your question provide very poor information and insight in your code. More data..

Meanwhile check if you actually import your modules correctly, should have:

import matplotlib.pyplot as plt

in order to use hist function

Upvotes: 17

Related Questions