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

部分基金数据获取抛出异常 #81

Closed
baei2048 opened this issue Jul 13, 2024 · 3 comments
Closed

部分基金数据获取抛出异常 #81

baei2048 opened this issue Jul 13, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@baei2048
Copy link

Describe the bug
调用如下接口,参数“515670”,报异常
adata.fund.market.get_market_etf("515670")

To Reproduce
Steps to reproduce the behavior:

  1. pip install adata
  2. open a new .py file and paste following
    import adata
    adata.fund.market.get_market_etf("515670")

Run

Expected behavior
Function crash

Screenshots
Crash Log:
Traceback (most recent call last):
File "d:\projects\outsource_data\main.py", line 37, in
adata.fund.market.get_market_etf("515670")
File "d:\InstalledApp\conda\envs\outsource_data\lib\site-packages\adata\fund\market\etf_market.py", line 30, in get_market_etf
return self.ths.get_market_etf_ths(fund_code, k_type, start_date, end_date)
File "d:\InstalledApp\conda\envs\outsource_data\lib\site-packages\adata\fund\market\etf_market_ths.py", line 50, in get_market_etf_ths
result_df = pd.DataFrame(data=data, columns=['trade_date', 'open', 'high', 'low', 'close', 'volume', 'amount'])
File "d:\InstalledApp\conda\envs\outsource_data\lib\site-packages\pandas\core\frame.py", line 851, in init
arrays, columns, index = nested_data_to_arrays(
File "d:\InstalledApp\conda\envs\outsource_data\lib\site-packages\pandas\core\internals\construction.py", line 520, in nested_data_to_arrays arrays, columns, index = nested_data_to_arrays(
File "d:\InstalledApp\conda\envs\outsource_data\lib\site-packages\pandas\core\internals\construction.py", line 845, in to_arraysuction.py", line 520, in nested_data_to_arrays
arrays, columns = to_arrays(data, columns, dtype=dtype) uction.py", line 942, in _finalize_columns_and_data
File "d:\InstalledApp\conda\envs\outsource_data\lib\site-packages\pandas\core\internals\construction.py", line 845, in to_arrays
content, columns = _finalize_columns_and_data(arr, columns, dtype)
File "d:\InstalledApp\conda\envs\outsource_data\lib\site-packages\pandas\core\internals\construction.py", line 942, in _finalize_columns_and_data
raise ValueError(err) from err
ValueError: 7 columns passed, passed data had 1 columns

Desktop (please complete the following information):

  • OS: windows 10
  • Browser Chrome
  • Python 3.10

Additional context
看上去是没有处理数据源返回的“空数据”。

@baei2048
Copy link
Author

517270, 517760,159646,159693,159769,159971 这几个参数同样的问题。

@1nchaos 1nchaos added the bug Something isn't working label Jul 15, 2024
@1nchaos
Copy link
Owner

1nchaos commented Jul 15, 2024

这个确实没有想过的数据了,后续增加了空数据判断

@1nchaos
Copy link
Owner

1nchaos commented Jul 16, 2024

更新到v2.4.0

@1nchaos 1nchaos closed this as completed Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants