我正在尝试根据查询结果删除行,但这给了我这个错误
df2.drop(df.query('group == "treatment" and landing_page !="new_page" or group != "treatment" and landing_page =="new_page"'),axis=1)
显示的错误是
ValueError: labels ['user_id' 'timestamp' 'group' 'landing_page' 'converted'] not contained in axis
答案 0 :(得分:0)
将index
输出中的query
与axis=0
一起用于以下行:
df2.drop(df.query('group == "treatment" and landing_page !="new_page" or group != "treatment" and landing_page =="new_page"').index, axis=0)