I habe a JSon Document, which i would like to convert to Excel or CSV. My JSON File looks like this:
df = pd.DataFrame(columns=[Store,Address,User,Rating], dtype='unicode')
With following data:
Store | Address | User | Rating
|:----------------------------------------:|
Store X| Adresse X | User 1 | 3
| | User 2 | 5
| | User 3 | 2
Store Y| Adresse Y | User 1 | 2
| | User 2 | 1
| | User 3 | 4
| | User 4 | 5
I tried following Code to convert the Json Doc to Excel:
jsonDoc = pd.read_json(df.to_json())
ExcelDoc = jsonDoc.to_excel("C:\Users\output.xlsx")
But i get following output:
Store | Address | User | Rating
|:-------------------------------------------------------:|
Store X| Adresse X | User 1,User2,User3 | 3,5,2
Store Y| Adresse Y | User 1,User2,User3,User4 | 2,1,4,5
But I would like to have my excel file like this:
Store | Address | User | Rating
|:----------------------------------------:|
Store X| Adresse X | User 1 | 3
Store X| Adresse X | User 2 | 5
Store X| Adresse X | User 3 | 2
Store Y| Adresse Y | User 1 | 2
Store Y| Adresse Y | User 2 | 1
Store Y| Adresse Y | User 3 | 4
Store Y| Adresse Y | User 4 | 5
Can somebody help me? how I can implement this? Is there a library that can handle it?