例子: df = pd.DataFrame() df['A'] = [1, 1, 2] df['B'] = [datetime.date(2018, 1, 2), datetime.date(2018, 1, 3), datetime.date(2018, 1, 3)] df['C'] = df.groupby('A').B.diff() df['C'] = df.C.dt.days 报错: Traceback (most recent call last): File "D:\python_v