I have a csv file that basically follows below, I'm trying to separate user's iteration number by week and plot a graph for each user.
Hora Nome completo
8/08/2017 19:00 Joao
8/08/2017 19:00 Joao
8/08/2017 19:00 Joao
8/08/2017 18:55 Lucas
8/08/2017 18:55 Joao
I managed a solution to organize user by date, I just could not plot yet, my code to organize
'import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime
import datetime as dt
import numpy as np
log_df = pd.read_csv('logs.csv',delimiter=",")
log_df['Hora'] = pd.to_datetime(log_df['Hora'])
df = log_df['Hora']
lenght = len(df)
tupla = [None]*lenght
for i in range(lenght):
m = df[i]
b = m.strftime("%Y-%m-%d")
tupla[i] = b
week = tupla
log_df['Hora'] = tupla
log_df.set_index(log_df['Hora'], inplace=True)
grouped2 = pd.DataFrame({'count' : log_df.groupby( [ "Hora", "Nome completo"] ).size()}).reset_index()
print(grouped2)
The output looks like this
Hora Nome completo Count
8/08/2017 Joao 4
8/08/2017 Lucas 1
In the case now I would like to plot a graphic user name and the access number for each week. My question is how do I post or split a week of the year?