matplotlib - I am trying to PLot Bar chart by integrating matplotlib with Pyspark. I am getting error
问题描述
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
解决方案
推荐阅读
- machine-learning - 没有标签的深度学习分类
- angular - Angular 7 将变量从组件传递到 app.component.ts
- firebase - 我在使用 Firebase Auth-UI 用户元数据时遇到问题
- reactjs - Bootstrap 4 - 反应 - 多行代码块
- r - 将点添加到条形图
- python - 如何删除数据框行索引?
- java - 在集合之间切换值得吗?
- php - http身份验证基本不适用于uri中的参数
- r - 在 R 中使用动态规划计算斐波那契
- python - ImportError:无法从“请求”导入名称“帖子”(C:\Program Files\Python37\lib\site-packages\request\__init__.py)