I have written a piece of code that gets data from a Google-Sheets doc through a path defined by IFTTT, DialogFlow and Hiroku, this happens through this snippet:
# Finding a workbook by name and opening the first sheet
sheet = client.open("IFTTT_Webhooks").sheet1
# Extract and print all of the values
list_of_answers = sheet.get_all_records()
#put the values from the list_of_answers into a csv and store locallyy.
with open('user_answers.csv', 'w') as myfile:
wr = csv.writer(myfile, quoting=csv.QUOTE_ALL)
wr.writerow(list_of_answers)
If I open 'user_answers.csv' the csv looks as such:
[{'Date/Time': 'February 19, 2020 at 09:49PM', 'Intent': 'poll_completed', 'Statement 1': 'yes', 'Statement 2': 'Sometimes', 'Statement 3': 'sometimes', 'Statement 4': 'yes'}, {'Date/Time': 'February 19, 2020 at 09:50PM', 'Intent': 'poll_completed', 'Statement 1': 'yes', 'Statement 2': 'never', 'Statement 3': 'never', 'Statement 4': 'no'}, {'Date/Time': 'February 19, 2020 at 10:48PM', 'Intent': 'poll_completed', 'Statement 1': 'yes', 'Statement 2': 'often', 'Statement 3': 'sometimes', 'Statement 4': 'yes'}, {'Date/Time': 'February 20, 2020 at 12:14AM', 'Intent': 'poll_completed', 'Statement 1': 'now', 'Statement 2': 'often', 'Statement 3': 'sometimes', 'Statement 4': 'yes'}]
How can I get this data in a table-format with the columns as such and their respective values:
Date/time, Statement 1, Statement 2, Statement 3, Statement 4
February 19, 2020 at 09:49PM. yes Sometimes Sometimes. no
It's ok if the csv format stays as is. But I want to be able to work with data more effectively in another file. So I want to create I guess a dataframe that considers this new (requested) table-format. Any help is appreciated.