TypeError: 'numpy.float64' object is not callable

Screen Link: https://app.dataquest.io/m/283/sampling/5/simple-random-sampling

My Code:

import pandas as pd
import matplotlib.pyplot as plt

wnba = pd.read_csv('wnba.csv')
sample_means = []
population_mean = wnba['PTS'].mean()

for i in range(100):
    sample = wnba['PTS'].sample(10, random_state=i)

plt.scatter(range(1,101), sample_means)

What actually happened:

TypeError: 'numpy.float64' object is not callable

I’m getting this error on the plt.axhline() line. I’ve tried running with my code and with the answer and the error persists. It seems like the plt.axhline is being read as a numpy.float64 object.

Thank you!


Hi @guilherme.tmiranda:

I was able to run your code and it was accepted successfully. Do you mind refreshing your screen?

1 Like

It seems you have redefined or reassign library method by mistake. You can reload module again by

import matplotlib.pyplot as plt

from importlib import reload

Let us know if issue still persists. :slight_smile:

More you can also refer this topic


I’ve reloaded plt and it worked. Thank you!

1 Like