首页 > 解决方案 > 选择 > 0 的系列元素

问题描述

我希望使用以下代码为箱线图获得 >0 的元素:

import seaborn as sns
d=pd.DataFrame({"r":[1,2,3]})
sns.boxplot(x=d[(d["r"]>0)])

这给出了错误

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

如何解决?

标签: pandas

解决方案


推荐阅读