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

Fixes ValueError in Cell 21. #3804

Conversation

joshuabuildsthings
Copy link
Contributor

Description

  • [ x] Summary of the change / bug fix.
  • In the recently updated economy report there was a ValueError in Cell 21 caused by a truthiness check on a pandas data frame. This caused economy reports to fail.
  • This was a minor change to one line and shouldn't require changes to documentation or existing tests.

How has this been tested?

  • Please describe the tests that you ran to verify your changes.
  • Unable to run economy report prior to the fix. Able to run it now.

Checklist:

Others

  • [ x] I have performed a self-review of my own code.
  • [x ] I have commented my code, particularly in hard-to-understand areas.

@reviewpad reviewpad bot added the feat XS Extra small feature label Dec 20, 2022
@joshuabuildsthings
Copy link
Contributor Author

Hi @hjoaquim & @jmaslek!

Thank you for the work on the custom economy report. I tried to run it and received an error; this patch should correct the issue.

@hjoaquim
Copy link
Contributor

Hey @joshuabuildsthings, thanks for this nice detail 🚀

I think this will not work in case the API key is defined for FRED. Reason is because of this line returning a tuple (if API key defined):

fred = openbb.economy.fred(series_ids=["T10Y3M"], start_date="1980-01-01") # this returns a tuple

IMO, the fix should be something like this instead:

fred = openbb.economy.fred(series_ids=["T10Y3M"], start_date="1980-01-01") # this returns a tuple

if fred:
    df, df_dict = fred

    (... code ...)
else:
    fred = None # we can ommit this if we want

And then we don't need to touch the final condition.

What do you think?

PS - I've tried to add those directly myself but got permission denied 😞

@hjoaquim
Copy link
Contributor

Also, don't forget to "Clear Output of All Cells" before commit 😄

joshuabuildsthings and others added 3 commits December 20, 2022 11:56
…buildsthings/GamestonkTerminal into fix/economy-report-error-09717374
…buildsthings/GamestonkTerminal into fix/economy-report-error-09717374
@joshuabuildsthings
Copy link
Contributor Author

Hey @joshuabuildsthings, thanks for this nice detail 🚀

I think this will not work in case the API key is defined for FRED. Reason is because of this line returning a tuple (if API key defined):

fred = openbb.economy.fred(series_ids=["T10Y3M"], start_date="1980-01-01") # this returns a tuple

IMO, the fix should be something like this instead:

fred = openbb.economy.fred(series_ids=["T10Y3M"], start_date="1980-01-01") # this returns a tuple

if fred:
    df, df_dict = fred

    (... code ...)
else:
    fred = None # we can ommit this if we want

And then we don't need to touch the final condition.

What do you think?

PS - I've tried to add those directly myself but got permission denied 😞

@hjoaquim Thank you for the feedback! I made the recommended changes & re-tested & it looks like everything worked as expected.

Hopefully I got the Clear Output of All Cells right this time 😄

Copy link
Contributor

@hjoaquim hjoaquim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the small comment, is looking alright!
Works perfectly on my end, both with and without FRED API key.

"id": "driven-billion",
"metadata": {},
"outputs": [],
"outputs": [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to get rid of these?

@joshuabuildsthings
Copy link
Contributor Author

@hjoaquim - I think I cleared the cells as you requested this time; also brought the feature branch up to date with the 2.1.0 from today.

@hjoaquim
Copy link
Contributor

@joshuabuildsthings not sure why (prob your fork settings) but can't update your branch 😢
We need you to update it before we're able to merge! 🚀

@joshuabuildsthings
Copy link
Contributor Author

@hjoaquim - Sorry about that. Adjusted the settings & merged the recent changes from main back in.

@hjoaquim hjoaquim merged commit 21247ac into OpenBB-finance:main Dec 24, 2022
@joshuabuildsthings joshuabuildsthings deleted the fix/economy-report-error-09717374 branch December 25, 2022 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat XS Extra small feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants