0
I have a csv file that basically follows below, I’m trying to separate user iteration number per 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 got a solution to organize user by date ,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 way out is like this
Hora Nome completo Count
8/08/2017 Joao 4
8/08/2017 Lucas 1
in case now I would like to plot a graph user name and access number for each week. My doubt is how I place or separate by week of the year agr?
I can show you the code you tried?
– Sidon
I commented the code but I’m not able to plot on the x-axis the number of weeks on that user’s axis and amount of access per week
– Matheus Francisco
In my opinion you should edit the question and incorporate your "answer" to it. The way you’re getting a little confused, the answer is an answer or a new question? :-)
– Sidon
I tried to explain better...thanks for the tip
– Matheus Francisco