Skip to content
Advertisement

The string is not callable in Python

I am trying to export a dict to a csv. I am pulling data from an api and need it to print to a CSV.

I am using:

JavaScript

The API I am calling is below:

JavaScript

Getting the data I would like to pull is here:

JavaScript

I am trying to use Pandas to send the data to the CSV file

JavaScript

The print collects the below data and I need this to populate the CSV file.

JavaScript

Now this is where I am getting stuck and receiving the error: TypeError: 'str' object is not callable

Advertisement

Answer

You need to pass the actual data structure, not the string that’s built by tabulate.

For example:

JavaScript

This gives you:

enter image description here

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement