AttributeError: module 'numpy' has no attribute 'dtype' 问题
2018-03-17 23:10
555 查看
记录下今天发生的问题。
在pycharm中命名了一个random.py,代码如下
import numpy as np
import pandas as pd
RandomNumber = np.random.choice([1,2,3,4,5],size=100,replace=True,p=[0.1,0.2,0.3,0.3,0.1])
print(pd.Series(RandomNumber).value_counts())然后执行出现了
File "pandas/_libs/src\numpy.pxd", line 157, in init pandas._libs.tslib
AttributeError: module 'numpy' has no attribute 'dtype'
报错信息。
纳闷了,代码怎么在命令行可以执行,在ide执行不了。
后来改了个文件名称,改为RandomNum.py就可以执行了。
因为对python不是很了解,所以不知道具体原因,猜想是因为文件名与函数名冲突了。
在pycharm中命名了一个random.py,代码如下
import numpy as np
import pandas as pd
RandomNumber = np.random.choice([1,2,3,4,5],size=100,replace=True,p=[0.1,0.2,0.3,0.3,0.1])
print(pd.Series(RandomNumber).value_counts())然后执行出现了
File "pandas/_libs/src\numpy.pxd", line 157, in init pandas._libs.tslib
AttributeError: module 'numpy' has no attribute 'dtype'
报错信息。
纳闷了,代码怎么在命令行可以执行,在ide执行不了。
后来改了个文件名称,改为RandomNum.py就可以执行了。
因为对python不是很了解,所以不知道具体原因,猜想是因为文件名与函数名冲突了。
相关文章推荐
- pytorch实践中module 'torch' has no attribute 'form_numpy'问题的解决
- 解决Pycharm中matplotlib画图出错问题(AttributeError: module 'matplotlib' has no attribute 'verbose')
- ansible安装遇到"AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'"的问题
- python错误:AttributeError: 'module' object has no attribute 'setdefaultencoding'问题的解决方法
- Tensorflow protobuf版本报错问题解决(AttributeError: 'module' object has no attribute 'Default')
- AttributeError 'module' object has no attribute 'handlers'--Python子模块导入问题
- 关于 AttributeError: module 'os' has no attribute 'fork' 问题
- python错误:AttributeError: 'module' object has no attribute 'setdefaultencoding'问题的解决方法
- AttributeError: 'module' object has no attribute 'handlers'--Python子模块导入问题
- 学习Python csv模块遇到AttributeError: module 'csv' has no attribute 'writer'和写入后出现空格问题
- Python问题分析:AttributeError: module 'sys' has no attribute 'setdefaultencoding'
- python3.6脚本import json模块后,报错:AttributeError: module 'json' has no attribute 'dumps'
- python __def__ Exception AttributeError: "'NoneType' object has no attribute
- service_identity 模块 AttributeError: 'module' object has no attribute 'Any'
- 【问题】Keras AttributeError: 'Tensor' object has no attribute '_keras_history'
- python 报错信息: AttributeError: module 'token' has no attribute '__all__'
- 对于AttributeError: ‘module’ object has no attribute ‘AF_INET’ 的错误原因
- Django报错:AttributeError: 'module' object has no attribute 的解决方法
- Python问题:AttributeError: '_csv.reader' object has no attribute 'next' 以及UnicodeDecodeError: 'gbk' co
- AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'seq2seq'