pandas value_couts遇到的问题
来源:互联网 发布:万网单域名控制台登录 编辑:程序博客网 时间:2024/06/08 07:24
python 使用pandas的value_counts函数时,出现错误
Traceback (most recent call last):
File "/Users/lumingshu/PycharmProjects/shunfeng/splitFile.py", line 34, in <module>
print data2['预测分级A'].value_counts(ascending=False)
File "/Users/lumingshu/Library/Python/2.7/lib/python/site-packages/pandas/core/series.py", line 601, in __getitem__
result = self.index.get_value(self, key)
File "/Users/lumingshu/Library/Python/2.7/lib/python/site-packages/pandas/indexes/base.py", line 2169, in get_value
tz=getattr(series.dtype, 'tz', None))
File "pandas/index.pyx", line 105, in pandas.index.IndexEngine.get_value (pandas/index.c:3567)
File "pandas/index.pyx", line 113, in pandas.index.IndexEngine.get_value (pandas/index.c:3250)
File "pandas/index.pyx", line 163, in pandas.index.IndexEngine.get_loc (pandas/index.c:4373)
KeyError: '\xe9\xa2\x84\xe6\xb5\x8b\xe5\x88\x86\xe7\xba\xa7A'
问题:对Series类型(变量data)使用value_counts, 错误的写成了data['a'].value_counts(), 应该是 data.value_counts()
- pandas value_couts遇到的问题
- 安装pandas遇到的问题
- 用Pandas画图遇到的问题(plot、pivot、unstack)
- pandas使用read_csv()读取文件遇到的问题
- pandas的问题总结
- python3 科学计算模块 numpy、pandas、sns、seaborn等模块安装遇到的问题
- 【pandas使用遇到的问题】Can only use .dt accessor with datetimelike values
- Python Pandas读取中文格式CSV文件遇到的问题(UTF-8与UTF-8 BOM)
- 【pandas使用遇到的问题】 have mixed types. Specify dtype option on import or set low_memory=False.
- pandas使用read_sql遇到的编码问题('latin-1' codec can't encode characters in position 12-15: ordinal not in r)
- pandas,横向Concat时遇到 Reindexing only valid with uniquely valued Index objects问题
- pandas的read_csv()函数读取的文件路径问题
- pandas append性能问题
- 今天遇到的问题
- 移植遇到的问题
- 我遇到的问题!!
- Java3D遇到的问题
- 最近几天遇到的问题.
- NYOJ:49-开心的小明
- 链表面试题(一):逆序打印链表、无头链表删除插入节点、约瑟夫环、逆置单链表
- 222.map4-百度地图添加覆盖物
- NYOJ:50-爱摘苹果的小明
- 矩阵乘法编写,从文件输入输出
- pandas value_couts遇到的问题
- PL/SQL面向过程语言
- 关于树状数组区间修改和查询详解
- 迷失的几个月
- Java开发IDE工具Eclipse使用笔记
- 破解vs2008
- framework学习之路
- 关于H5端大图上传的问题
- 在多线程中注入spring对象