Statistics Fundamentals > Visualizing Frequency Distributions > Step 9 answer busted

Screen Link:
https://app.dataquest.io/m/286/visualizing-frequency-distributions/9/binning-for-histograms

My Code:

# your suggested answer
wnba['Games Played'].plot.hist(range = (1,32), bins = 8,
                               title = 'The distribution of players by games played')
plt.xlabel('Games played')

What I expected to happen:
A histogram with an X axis label Games Played.

What actually happened:

# plot renders without label and this error is logged
TypeError: 'str' object is not callable
# if you add the import you get a different error 
from matplotlib.pyplot import plot as plt

This code worked though so I’m not stuck, just trying to help quality control.

my_plot = wnba['Games Played'].plot.hist(range = (1,32), bins = 8,
                               title = 'The distribution of players by games played')
my_plot.set_xlabel('Games played')
5 Likes

Not fixed as of September. Thank you for showing a correct solution in the mean time to help others progress.

Notifying @Sahil of this.

1 Like

Hi All,

I couldn’t find any issue with the solution code on my end. Based on the error code TypeError: 'str' object is not callable, I believe you may have accidentally modified the plt.xlabel function like this:

plt.xlabel = 'Games played'

Here is a workaround to fix this issue.

Best,
Sahil

4 Likes