API-FOOTBALL

फ्रीमियम
Verified
द्वारा API-SPORTS | अपडेट किया गया 7 days ago | Sports
लोकप्रियता

10 / 10

लेटेंसी

367ms

सेवा का स्तर

99%

Health Check

N/A

सभी चर्चाओं पर वापस जाएं

Iterating over JSON data and printing. (or creating Pandas DataFrame from JSON file)

Rapid account: Ckelleher Bektqav Qm

Hello - I’m trying to print specific values from the JSON file that I pulled using API-Football using the /players functionality. From what I understand, I am pulling it as a JSON file that has a list of dictionaries of players, with a nested dictionary for each player containing their data (i.e. name, team, etc.).

I’m running into issues printing the values within the ‘player’ dictionary, as each character is printing on a separate line.

The end result I am trying to get to is a Pandas DataFrame containing all the values from the JSON file, but I can’t even seem to iterate through the JSON file correctly.

Here is my code:

url = "https://api-football-v1.p.rapidapi.com/v3/players"

querystring = {"league":"39","season":"2020", "page":"2"}

headers = {
		"X-RapidAPI-Host": "api-football-v1.p.rapidapi.com",
		"X-RapidAPI-Key": "xxxxxkeyxxxxx"

}

response = requests.request("GET", url, headers=headers, params=querystring).json()

response_dump = json.dumps(response)

for item in response_dump:
	for player_item in item:
		print(player_item)

चर्चा में शामिल हों - नीचे टिप्पणी जोड़ें:

नई टिप्पणियाँ पोस्ट करने के लिए लॉग इन / साइनअप करें