pandas - 选择 > 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().
如何解决?
解决方案
推荐阅读
- spring-boot - 春季云发现服务-注册安全客户端-healthCheckUrl
- python - 如果某些元素重复相同的时间,则列表中的最高出现次数
- scala - 配置 SBT 全局设置
- html - 为什么异步管道“InvalidPipeArgument: '[object Object],[object Object],' for pipe 'AsyncPipe'”中有错误?
- php - 如何获取返回值以在控制器中使用
- angular - 如何将工具提示添加到 Angular 材料步进器
- gcc - arm-linux-gnueabi-gcc 无法编译?
- sql - 识别组在多列 SQL 中具有相同的值
- javascript - 无限滚动加载dom元素,然后将jquery应用于元素?
- python - 处理多个数组