atreadw1492 / yahoo_fin

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

Issue with get_day_gainers() #109

Open getsharmagunjan opened 11 months ago

getsharmagunjan commented 11 months ago

Hi,

I want to get Day's Gainers for NSE market (India). But get_day_gainers() returns data for US market only. (Alothough get_analysts_info("RELIANCE.NS") works fine)

Is there any way I can get Day's gainers for NSE Market only?

StephanAkkerman commented 7 months ago

There is another issue with get_day_gainers() at the moment

File "D:\Anaconda\envs\discord\lib\site-packages\yahoo_fin\stock_info.py", line 620, in get_day_gainers
    return _raw_get_daily_info(f"https://finance.yahoo.com/gainers?offset=0&count={count}")
  File "D:\Anaconda\envs\discord\lib\site-packages\yahoo_fin\stock_info.py", line 606, in _raw_get_daily_info
    df[field] = df[field].map(_convert_to_numeric)
  File "C:\Users\Stephan\AppData\Roaming\Python\Python310\site-packages\pandas\core\series.py", line 4540, in map
    new_values = self._map_values(arg, na_action=na_action)
  File "C:\Users\Stephan\AppData\Roaming\Python\Python310\site-packages\pandas\core\base.py", line 921, in _map_values
    return algorithms.map_array(arr, mapper, na_action=na_action, convert=convert)
  File "C:\Users\Stephan\AppData\Roaming\Python\Python310\site-packages\pandas\core\algorithms.py", line 1814, in map_array
    return lib.map_infer(values, mapper, convert=convert)
  File "lib.pyx", line 2920, in pandas._libs.lib.map_infer
  File "D:\Anaconda\envs\discord\lib\site-packages\yahoo_fin\stock_info.py", line 55, in _convert_to_numeric
    if "M" in s:
TypeError: argument of type 'float' is not iterable