Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

compute difference in dates after groupby

df['diff'] = df.groupby('Type')['Date'].apply(lambda x: x.dt.date - x.min().date())
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #compute #difference #dates #groupby
ADD COMMENT
Topic
Name
3+4 =