0

if I have a data set of time series and I want to estimate the number of the day of a groupby time series per each day as seen in the figure and act as a counter :

enter image description here

nothing special in my code yet, it is just reading the data and convert time and day into

import pandas as pd  
df = pd.read_csv('*file location and name*',sep=",")
df.head()
df['Date'] =pd.to_datetime(df['Date']+" "+df['Time'])
df.set_index('Date', inplace=True)
Derlin
  • 9,572
  • 2
  • 32
  • 53
Mostafa Gafer
  • 63
  • 3
  • 14

1 Answers1

0

See if answers your query:

df['dayOfMonth']= df.groupby('day').cumcount() + 1
pizza lover
  • 503
  • 4
  • 15