us-bea / beaapi

A Python library library to make it easier to retrieve and work with BEA data.
https://us-bea.github.io/beaapi/
Creative Commons Zero v1.0 Universal
21 stars 4 forks source link

Consider lighter implementation of BEA API #3

Open tomigee opened 8 months ago

tomigee commented 8 months ago

Hi there, First off, thanks for providing this library. I've been curious about economic data for a while and have finally started delving into it to see what I can learn. For just over a month now, I've been developing on top of other API (Congress.gov as well as FRED). Both of these APIs have python wrappers--developed either by the team managing the API or the open source community--that return the response of the API servers with minimal processing.

I've noticed that your implementation leverages the pandas library pretty heavily. Although this library provides easy readability for manual data queries, it unfortunately imposes additional overhead for people looking to develop on top of this library you've created. As such, I'd advocate for allowing this package operate in two modes: A human readable pandas mode, and a machine-readable versatile mode, where the versatile mode directly sends the response of successful queries directly from the BEA API.

Creating this machine-readable mode would make this library much easier to develop on. Please consider it and let me know what you think!

bquistorff commented 1 month ago

Thanks for your comment! You can use the underlying api_requests() to get the data as a string (as_string=True), the raw URL request return value (as_table=False), or as a dictionary (as_dict=True).