dpguthrie / dpguthrie/yahooquery
Converting data in a dictionary format into one in Pandas DataFrame
- Dominant language
- Python
- Stars
- 920
- Forks
- 164
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
When obtaining the data via yahooquery, there seem to be Python dictionary and Pandas DataFrame formats. I would like to be able either to convert between those two formats OR to obtain data in whichever format.
```
aapl = Ticker('aapl')
aapl.institution_ownership
aapl = Ticker('aapl')
aapl.get_modules('institutionOwnership')
```
The advantage is that I can just call `all_modules` once and get every module (e.g., `institutionOwnership` and others) already. Saving requests and not reaching the rate limit.
Another advantage is that depending one when/why/how, I use one method or another. It'd be easier to compare two different data from the same ticker, etc.
**Describe the solution you'd like**
Is there a way to convert data in a dictionary format into one in Pandas DataFrame (vice verse).
For example, I can take `aapl.get_modules('institutionOwnership')` and turn it into the same DF format as `aapl.institution_ownership`
```
aapl = Ticker('aapl')
dict_to_dataframe(aapl.get_modules('institutionOwnership'))
```
or
```
aapl = Ticker('aapl')
data = aapl.all_modules
dict_to_dataframe(data['institutionOwnership'])
```
In fact, some of these seems to be already available via functions in `ticker` class, e.g., `to_dataframe`.
Or perhaps there's already a way to do this :)
**Describe alternatives you've considered**
Alternatively, I just call `aapl.institution_ownership` and other modules one-by-one. It's a bad since calling all_modules is just one call, so it would save everyone many requests.
Contributor guide
Assessment
This issue has not been assessed yet.