I am trying to plot a bar chart using matplotlib in pyspark, i am getting error.
import matplotlib.pyplot as plt
%matplotlib inline
x_labels = violationcode_freq['Violation Code'].values
fig = violationcode_freq[['count']].plot(kind='bar', facecolor='lightblue')
fig.set_xticklabels(x_labels)
fig.set_title('Counts of trips by passenger count')
fig.set_xlabel('Passenger count in trips')
fig.set_ylabel('Trip counts')
plt.show()
Error :
TypeError Traceback (most recent call last)
<ipython-input-22-19a8720dda44> in <module>()
1 import matplotlib.pyplot as plt
2 get_ipython().run_line_magic('matplotlib', 'inline')
----> 3 x_labels = violationcode_freq['Violation Code'].values
4 fig = violationcode_freq[['count']].plot(kind='bar', facecolor='lightblue')
5 fig.set_xticklabels(x_labels)
TypeError: 'NoneType' object is not subscriptable