question

tbo2020 avatar image
0 Likes"
tbo2020 asked ·

Convert python SDK response to XLS or CSV

How can this be done, Standard JSON converters fail

python-sdk
10 |600 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

· Write an Answer
intrinio avatar image
0 Likes"
intrinio answered ·

You can find working Python examples in Collaboratory (a Jupyter notebook type browser-based environment) here:

https://github.com/intrinio/intrinio-tutorials

Most of the examples there take the SDK response and convert it to a data frame:

try:
  api_response = fundamentals_api.get_fundamental_standardized_financials(latest_balance_sheet_id)
except: 
  print('oops!
#The api response has many parts- meta data, data about the api call. What we want is a dataframe of the balance sheet.
#The loop below pulls the standardized financials out of the response and converts them to a dataframe. 

statement = {}
for standardized_financial in api_response.standardized_financials:
  statement[standardized_financial.data_tag.tag] = standardized_financial.value

#Convert to df
intrinio_balance_sheet = pd.DataFrame(statement, index = [0])


· Share
10 |600 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.