Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pandas版本0.25.3 numpy版本1.20.0,执行us_get_info.py报错:<attribute 'dtype' of 'numpy.generic' objects> #15

Open
aoxiansheng opened this issue Mar 28, 2021 · 0 comments

Comments

@aoxiansheng
Copy link

aoxiansheng commented Mar 28, 2021

开发者您好:
pandas版本0.25.3 numpy版本1.20.0,执行us_get_info.py报错:<attribute 'dtype' of 'numpy.generic' objects>
尝试了一些旧版本numpy,1.18.1还有1.16.5会报错:numpy.ndarray size changed, may indicate binary incompatibility,尝试改变pandas的版本,比如最新的,又会报错:pandas.errors.ParserError: Error tokenizing data...

请教您的环境是哪个版本的numpy?

Traceback (most recent call last):
File "D:/Depix-main/newmarket-breadth-main/task/us_get_info.py", line 28, in
mydb.upsert_table(info_table, spx_columns, us.get_spx())
File "D:/Depix-main/newmarket-breadth-main/task..\tools\util\us.py", line 41, in get_spx
return pd.DataFrame({'code': symbol_list, 'name': name_list, 'is_spx': 'Y', 'sp_sector': sector_list})
File "D:\Depix-main\venv\lib\site-packages\pandas\core\frame.py", line 411, in init
mgr = init_dict(data, index, columns, dtype=dtype)
File "D:\Depix-main\venv\lib\site-packages\pandas\core\internals\construction.py", line 257, in init_dict
return arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
File "D:\Depix-main\venv\lib\site-packages\pandas\core\internals\construction.py", line 82, in arrays_to_mgr
arrays = _homogenize(arrays, index, dtype)
File "D:\Depix-main\venv\lib\site-packages\pandas\core\internals\construction.py", line 322, in _homogenize
val = sanitize_array(
File "D:\Depix-main\venv\lib\site-packages\pandas\core\internals\construction.py", line 712, in sanitize_array
subarr = construct_1d_arraylike_from_scalar(value, len(index), dtype)
File "D:\Depix-main\venv\lib\site-packages\pandas\core\dtypes\cast.py", line 1233, in construct_1d_arraylike_from_scalar
subarr = np.empty(length, dtype=dtype)
TypeError: Cannot interpret '<attribute 'dtype' of 'numpy.generic' objects>' as a data type

进程已结束,退出代码1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant