i am attempting to use github api to get job postings for different technologies and then store them on a excel file, when i utilize this code i am not able to retrieve the information
import requests
baseurl = "https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBM-DA0321EN-
SkillsNetwork/labs/module 1/datasets/githubposting.json"
response = requests.get(baseurl)
if response.ok:
data = response.json()
print(data)
number_of_jobs=data.groupby('technology').sum().loc[technology,:][0]
but when i try to execute i get an error saying 'list' object has no attribute 'groupby' any suggestion on how i can fetch the information and then store it on excel file?
CodePudding user response:
Create a csv file (which will be opened by Excel)
import requests
baseurl = "https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBM-DA0321EN-SkillsNetwork/labs/module 1/datasets/githubposting.json"
response = requests.get(baseurl)
if response.ok:
data = response.json()
with open('out.csv','w') as f:
for e in data:
f.write(f'{e["A"]},{e["B"]}\n')
out.csv
technology,number of job posting
java,92
C,184
C#,14
C ,24
Java,92
JavaScript,65
Python,51
Scala,47
Oracle,6
SQL Server,16
MySQL Server,5
PostgreSQL,17
MongoDB,4