注意这里用DataFrame/Series运算的时候一定要用.values!!!,不然他会按照索引对齐运算,就全都等于0了。。。 df: df.iloc[:-1,:] - df.iloc[1:,:] df = self.df.iloc[:-1,:].values - df.iloc[1:,:]