Pandas 多条件过滤 with or 语句
Pandas multiple conditions filtering with or statement
想看看是否有人知道如何在 pandas 中链接多个条件......我正在寻找这样的形式:
df[(df.col1>2)&df.col2<5) or (df.col5==5)&(df.col3>=78)]
到目前为止,我还没有找到允许我像示例中那样包含 or 条件的解决方案。
任何帮助os感谢1
相同并且有一个字符所以剂量或使用|对于或陈述
有时 pandas 更喜欢 ()
df[((df.col1>2)&df.col2<5)) | ((df.col5==5)&(df.col3>=78))]
想看看是否有人知道如何在 pandas 中链接多个条件......我正在寻找这样的形式:
df[(df.col1>2)&df.col2<5) or (df.col5==5)&(df.col3>=78)]
到目前为止,我还没有找到允许我像示例中那样包含 or 条件的解决方案。
任何帮助os感谢1
相同并且有一个字符所以剂量或使用|对于或陈述 有时 pandas 更喜欢 ()
df[((df.col1>2)&df.col2<5)) | ((df.col5==5)&(df.col3>=78))]