I'm trying to plot the following dataset as a line graph with multiple lines over day and then another graph showing over month (depending on how messy the day graph is).
The data is in the following structure:
date_played acousticness danceability energy instrumentalness liveness speechiness
0 29/10/2019 18:57 0.083100 0.439 0.870 0.861000 0.4000 0.0375
1 30/10/2019 07:27 0.083100 0.439 0.870 0.861000 0.4000 0.0375
2 30/10/2019 07:30 0.082200 0.638 0.668 0.000000 0.0815 0.0259
3 30/10/2019 07:30 0.000031 0.469 0.932 0.000121 0.0799 0.0759
4 30/10/2019 07:36 0.082200 0.638 0.668 0.000000 0.0815 0.0259
5 30/10/2019 07:40 0.000031 0.469 0.932 0.000121 0.0799 0.0759
I've tried multiple methods from googling around/using Stack Overflow but I can't get it close and would like to see how it's done.
I was trying to group the data together to a day level and then average the values up so that I had one record per day which can be plot easily. The best I could get was a count of records per day which is far from what I want.
Thanks in advance
Edit:
data6temp = data6[['date_played','acousticness','danceability','energy','instrumentalness','liveness','speechiness']]
gets me the dataset. I tried this
print (data6temp.resample('D').mean())
and this link to other answer and a few others that didn't work so I've since removed the code from my workbook. I've also tried to do this on a table with just the date_played and the energy column but couldn't get this to provide me with a daily average either. I'm just not sure how to transform the dataset from date/time to a grouped date view and averaging the remaining values.
Also tried this (another attempt):
data6temp.groupby([data6temp.Time.dt.strftime('%D %M %Y')])['energy'].mean().reset_index(name="Daily Avg")
but it comes up saying AttributeError: 'DataFrame' object has no attribute 'Date'