如何根据 pandas 和 python 的多列和条件删除行?

how to delete rows based on multiple columns and condition with pandas and python?

数据: 考虑这个样本数据集 https://docs.google.com/spreadsheets/d/17Xjc81jkjS-64B4FGZ06SzYDRnc6J27m/edit#gid=1176233701

如何根据多列条件删除行行?

我正在根据我之前询问的线程过滤数据。 该线程中的解决方案以错误告终

我想根据上述线程中的编辑部分过滤数据?

您可以使用 & 运算符组合过滤器,如下所示:

# Dataframe with random values in range [0, 100] with shape [100,4]
df = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD'))

# Example filters
filter1 = df['A'] > 10
filter2 = df['B'] > 90
filter3 = df['C'] > df['D']

# Filter/remove rows
df[filter1 & filter2 & filter3]

OUTPUT:
    A   B   C   D
0   51  92  73  36
17  73  95  77  20
91  88  95  79  54
95  68  99  68  40