Closed behas closed 2 years ago
You can create dataframes directly from the CSV endpoints. For instance:
df = pandas.read_csv(api_instance.list_entity_addresses_csv(currency, 1, _preload_content=False))
I'll add examples to the docs, ok?
Thanks for clarification; adding an example is certainly a first step. However, I'd argue it is a bit counter-intuitive.
Is it, in general possible, to wrap the low-level automatically generated API into a higher-level API? I'm imagining a single module that mirrors the API and just hides all the details underneath.
How would this work if data is retrieved in chunks? This would then 1 df per chunk, right? It is possible to concat df, but that it is not encouraged in pandas because it is slow.
I guess by "hiding details underneath" you mean retrieving large data sets transparently, ie. in a streaming way?
streaming in the sense of iterating under the hood and then returning a final combined dataframe. I will put the procedures I am using into separate module and then we can discuss API usability issues.
Actually, the csv endpoints stream the complete data already, hence no pages. So above code will give you all entity addresses in one DF.
obsolete due to new bulk
endpoint
The API currently returns data as arrays of JSON objects. On the client side people often work with pandas dataframes and must convert these arrays. Since this is repetitive, it would be great if the API could offer retrieved data optionally also flattened dataframe. Here is. the code I am using for the conversion: