【发布时间】:2021-02-12 03:20:19
【问题描述】:
我在 Python 中有 DataFrame,如下所示:
df = pd.DataFrame({"col1" : ["a", "b", "c"], "col2" : ["a", "d", "e"], "col3" : ["r", "t" , "g"]})
我想检查哪些列的值是“a”(当然是在“col1”和“col2”中)。如何查看?
【问题讨论】:
-
预期输出如何?是
list?还是Series?还是过滤列?
标签: python pandas dataframe filter