How can I match data only by months and dates and not by year:
Advertisement
Answer
Convert Time
column to datetimes and then to custom format MM/DD/
and then aggregate:
df['Time'] = pd.to_datetime(df['Time']).dt.strftime('%m/%d/') df1 = df.groupby('Time').first()
If need aggregate sum
, mean
if duplicates use:
df2 = df.groupby('Time').sum(min_count=1) df3 = df.groupby('Time').mean()