Table(df):
customer_id Order_date
1 2015-01-16
1 2015-01-19
2 2014-12-21
2 2015-01-10
1 2015-01-10
3 2018-01-18
3 2017-03-04
4 2019-11-05
4 2010-01-01
3 2019-02-03
3 2020-01-01
3 2018-01-01
Output needed: A subset of the df where customer_IDs have more than 3 order_dates. (skipping 2,4 and 5 customer ID since they have less than 3 order_dates)
Customer_id Number_of_Order_dates
1 3
3 5
I have tried groupby but it has not worked to create a subset. Please help.
Codes tried so far which failed:
df[df['days'].count()>3]
and one more I tried which is incorrect:
df1=df.groupby('customer_id')['order_date'].count()
df[df1.iloc[:,1]]