atreadw1492 / yahoo_fin

Scrape stock price history from new (Spring 2017) Yahoo Finance layout
MIT License
286 stars 125 forks source link

get_stats throws ValueError: Length mismatch: #28

Closed saswatanand closed 3 years ago

saswatanand commented 3 years ago

get_stats('arry') throws:

Traceback (most recent call last): File "test.py", line 20, in <module> print(si.get_stats('arry')) File "/home/saswat/.local/lib/python3.6/site-packages/yahoo_fin/stock_info.py", line 242, in get_stats table.columns = ["Attribute" , "Value"] File "/home/saswat/.local/lib/python3.6/site-packages/pandas/core/generic.py", line 5154, in __setattr__ return object.__setattr__(self, name, value) File "pandas/_libs/properties.pyx", line 66, in pandas._libs.properties.AxisProperty.__set__ File "/home/saswat/.local/lib/python3.6/site-packages/pandas/core/generic.py", line 564, in _set_axis self._mgr.set_axis(axis, labels) File "/home/saswat/.local/lib/python3.6/site-packages/pandas/core/internals/managers.py", line 227, in set_axis f"Length mismatch: Expected axis has {old_len} elements, new " ValueError: Length mismatch: Expected axis has 4 elements, new values have 2 elements

It happens for all stocks (e.g., sol.mc, neoen.pa) for which quarterly-report numbers are not available for all quarters.