How to create a Pandas DataFrame from Insightly JSON output

I want to create a simple table of my customers' names and addresses using Python and Pandas and just learning both.

I use Python requests.get to successfully access my customer list and put the JSON data into a variable "r"

r = requests.get('https://api.insight.ly/v2.2/Contacts', auth=('my_api_key',''))  #<<=this works

Here's an example of a sample table (not using my JSON data), but works:

sales = [('Jones LLC', 150, 200,50),
('Alphas Co',200,210,90),
('Blue Inc', 140,215,95)]

labels = ['account', 'Jan', 'Feb', 'Mar']

df= pd.DataFrame.from_records(sales, columns=labels) #<==I use this to construct the DataFrame

df  #<==this prints the table below:

account Jan Feb Mar
0 Jones LLC 150 200 50
1 Alphas Co 200 210 90
2 Blue Inc 140 215 95

I want to construct a similar table, just with Customer Name and Address with my API-accessed JSON data, but I'm not having any luck with parameters and would love to know how to do it.

 

0

Comments

0 comments

Please sign in to leave a comment.