import pandas as pd from datetime import timedelta ar = pd.read_csv('nowcoder.csv',sep=',') #转换日期格式+去重 ar.date=pd.to_datetime(ar.date).dt.date ar.drop_duplicates(subset=['user_id','date'],keep='first',inplace=True) #两次表格合并 c=pd.merge(ar,ar,on='user_id',suffixes=['_a','_b']) d=pd.merge(c,ar,on='user_...