petercerno / good-morning

Simple Python module for downloading fundamental financial data from financials.morningstar.com.
Other
189 stars 82 forks source link

KeyRatiosDownloader ValueError #15

Open LcMaculan opened 6 years ago

LcMaculan commented 6 years ago

Hello, I'm trying to download KeyRatios in this way:

import good_morning as gm
kr = gm.KeyRatiosDownloader()
kr_frames = kr.download('AAPL')

output is:

701 
702     if copy:
--> 703         return arr.astype(dtype)
704     return arr.view(dtype)
705 

ValueError: could not convert string to float: 'false'

Some advice? Thanks

ikoniaris commented 6 years ago

This used to work up until some days ago. It looks like there was some change on Morningstar's side and wherever there is a hyphen indicating a blank value in a financial statement, the data frame ends up having the word 'false' there instead.

You can fix it by adding: output_frame.replace('false', 'NaN', regex=True, inplace=True) at the end of the _process_frame method, above the return statement.

ikoniaris commented 6 years ago

It looks like it started working again, but perhaps it's worth adding that extra line in the method just in case there is some change in the future.

LcMaculan commented 6 years ago

Perfect, thank you vary much.

ethanopp commented 5 years ago

Getting different error with same run code:

kr = gm.KeyRatiosDownloader()
kr_frames = kr.download('AAPL')
print(kr_frames)

returns

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Users\OPPENE\AppData\Local\JetBrains\Toolbox\apps\PyCharm-C\ch-0\182.3911.33\helpers\pydev\_pydev_bundle\pydev_umd.py", line 194, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "C:\Users\OPPENE\AppData\Local\JetBrains\Toolbox\apps\PyCharm-C\ch-0\182.3911.33\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/OPPENE/PyCharm/Projects/FinanceValuation/pullData.py", line 115, in <module>
    kr_frames = kr.download('AAPL')
  File "C:\Users\OPPENE\PyCharm\Projects\FinanceValuation\good_morning\good_morning.py", line 91, in download
    raise ValueError("MorningStar cannot find the ticker symbol "
ValueError: MorningStar cannot find the ticker symbol you entered or it is INVALID. Please try again.
pine199405 commented 5 years ago

Getting different error with same run code:

kr = gm.KeyRatiosDownloader()
kr_frames = kr.download('AAPL')
print(kr_frames)

returns

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Users\OPPENE\AppData\Local\JetBrains\Toolbox\apps\PyCharm-C\ch-0\182.3911.33\helpers\pydev\_pydev_bundle\pydev_umd.py", line 194, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "C:\Users\OPPENE\AppData\Local\JetBrains\Toolbox\apps\PyCharm-C\ch-0\182.3911.33\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/OPPENE/PyCharm/Projects/FinanceValuation/pullData.py", line 115, in <module>
    kr_frames = kr.download('AAPL')
  File "C:\Users\OPPENE\PyCharm\Projects\FinanceValuation\good_morning\good_morning.py", line 91, in download
    raise ValueError("MorningStar cannot find the ticker symbol "
ValueError: MorningStar cannot find the ticker symbol you entered or it is INVALID. Please try again.

Yes, it is. Have you found a method to solve this?

sabarigirish007 commented 4 years ago

ya i am seeing the same issue