pandas - AttributeError:“DataFrame”对象没有属性“question_response”
问题描述
我正在尝试为以下数据集绘制条形图
qr_count
question_title question_response
The course recommended books etc. are relevant and appropriate: agree 116
The course workload is manageable: agree 112
I think I have made progress in the course: agree 111
The Course is well organized / updated : agree 103
The course contents increased my knowledge of the subject: agree 103
我已经使用这种方法从另一个数据帧中提取了这个数据帧
each_qt_count = new_merge_data[['question_title', 'question_response']].value_counts()
each_qt_count = pd.DataFrame(each_qt_count)
each_qt_count.rename(columns={0:'qr_count'}, inplace=True)
each_qt_count.head()
new_merge_data 具有以下行
Index(['question_id', 'question_title', 'course_title', 'course_code',
'course_assign_id', 'id', 'question_response', 'student_id',
'date_created'],
dtype='object')
现在我正在尝试使用这种方法绘制 each_qt_count
plt.bar(each_qt_count.question_response, each_qt_count.qr_count)
它给了我这个错误
AttributeError:“DataFrame”对象没有属性“question_response”
请帮助我如何为这个数据框绘制条形图?
提前致谢
解决方案
推荐阅读
- c++ - 使用 sv hup SIGHUP 信号重新加载配置时出现问题
- sql-server - 结果集的 AVG
- css - 从移动设备访问网站时,Wordpress 自定义 Css 未更新
- c# - 带有异步 lambda 表达式的异步方法
- angular - NGXS - 从父状态访问子状态
- java - 如何测试是否调用了 Servlet 过滤器
- php - Laravel 和 Ajax - 在列字段为真时禁用提交按钮
- azure - azure search - 模型/查询复杂模型类型
- c++ - 这是 Clang 6.0 附带的 Coroutines TS 实现中的错误吗?
- c - c语言中typedef的使用?