bankrollhunter / market-breadth

计算美股、A股市场宽度
MIT License
191 stars 95 forks source link

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

Open aoxiansheng opened 3 years ago

aoxiansheng commented 3 years ago

开发者您好: 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