boolean您可以像使用索引一样使用索引numpy.arraydf = pd.DataFrame({'Data':np.random.normal(size=200)})# example dataset of normally distributed data. df[np.abs(df.Data-df.Data.mean()) <= (3*df.Data.std())]# keep only the ones that are within +3 to -3 standard deviations in the column 'Data'.df[~(np.abs(df.Data-df.Data.mean()) > (3*df.Data.std()))]# or if you prefer the other way around对于一个系列,它是相似的:S = pd.Series(np.random.normal(size=200))S[~((S-S.mean()).abs() > 3*S.std())]