I am trying to merge 2 Dfs under curtain conditioning on dates.
Let's say to today is 2015-01-12, what I'm trying to do is for every clienthostid that has first_activity date earlier than 10 days before today to be excluded from df2, so in the example here I'd be left if df2 with:
I tried to do so by first merging the 2 df:
temp = pd.merge(df1, df2, on='clienthostid', how='inner')
and then try to delete according to the condition:
temp = temp[temp.First_activity + 10 < today]
and I'm getting this error:
TypeError: cannot operate on a series without a rhs of a series/ndarray of type datetime64[ns] or a timedelta
First_activity and today are datetime64...
I'm not familiar much with sql, python nor pandas (with sums it all I guess :)), but I've got an assignment to implement this so sorry if the question stupid.
I think you need convert
to_timedelta
int value or use offsets:Or: