1

with this code:

import pandas as pd
import requests
import json

url = 'https://www.loves.com/api/sitecore/StoreSearch/SearchStores'

#get the data from url
response = requests.get(url).json()

df = pd.read_json(url)

df1 = pd.json_normalize(response)

both DFs return this: enter image description here

This is what the response looks like enter image description here

How to get normal pandas dataframe?

2 Answers 2

3

Try it like this

import pandas as pd
import requests
import json

url = 'https://www.loves.com/api/sitecore/StoreSearch/SearchStores'

#get the data from url
response = requests.get(url).json()

df1 = pd.json_normalize(response, record_path=['Points'])
Sign up to request clarification or add additional context in comments.

1 Comment

3

I found the answer, this made the trick

df1 = pd.json_normalize(response, record_path=['Points'])

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.