我正在寻找一种通过以下条件过滤 df 的方法:
created_by
列中的值等于 owner
列中的值且 status
等于 'Active'
答案 0 :(得分:0)
解决方案:
(df['created_by']==df['owner']) & (df['status']=='Active')
并请阅读用户指南:Indexing and selecting data
答案 1 :(得分:0)
您要实现的条件的逻辑是,您要过滤其 created_by 值与其所有者值不同且状态应为活动的所有行。
if ((customers_df["created_by"] == customers_df["owner"]) & (customers_df["status"] == "Active")):
# do your Business logic