-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Return a dataframe from stocks search, removed export to file system (#3923) #4193
Merged
jmaslek
merged 8 commits into
OpenBB-finance:develop
from
joey-walker:feature/search-return-df
Feb 10, 2023
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
373f387
Return a dataframe from stocks search, allow override to not export t…
joey-walker 06b9196
Fix documentation to reflect changes in search method in sdk
joey-walker f247b6d
Remove export_to_file flag for redundancy
joey-walker d0d1eb8
Remove erroneous extra line from documentation
joey-walker 5c2cbf2
Merge branch 'develop' into feature/search-return-df
jmaslek e31c206
Merge branch 'develop' into feature/search-return-df
jmaslek a11810a
Remove export to file now that we are returning a dataframe. Always …
joey-walker 047ee64
Merge branch 'develop' into feature/search-return-df
jmaslek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not following the logic of this
export_to_file
. If export=="", which it is by default, nothing gets saved.The way we have our sdk is that exporting should not be handled through this. Returning a df allows you to save, ie
openbb.stocks.search("Apple").to_csv("path/to/file"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you are right. The underlying function does have that check, I should have noticed.
I am not sure if I fully understand your second point as I see that as feature/benefit. Is it going against the design methodology? Is there an alternative method for retrieving the results into memory without hitting the file system?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it is against our design to have the export in the sdk model functions. In this example, if you just call
df = openbb.stocks.search("Apple")
That will be in your memory locally. If you want to save to a file you can using pandas built-ins.
I might not be understanding what you wish to accomplish. When you say you want it into memory, what are you hoping to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just pushed some commits to remove that redundant flag that I added. Updated documentation as well.
The desire behind this pull request is to enable this particular function to actually return the results in dataframe format - if any are available - exactly as you said:
df = openbb.stocks.search("Apple")
Right now - from my understanding - It doesn't return anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that is correct. You fixed that by returning the df. We just dont need to have the export/sheet name in the model functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah now I understand! (Hopefully).
I pushed a commit that removes the export/sheet name in that function. I adjusted and ran the tests to success.
Also redid my initial manual testing.
I also saw the mypy failures, and changed the return statements to give back an empty dataframe. Similar to other functions in the same file.