pandas.Series.any 方法

pandas.Series.any 方法

描述

Series.any(*, axis=0, bool_only=False, skipna=True, **kwargs)
返回是否任意元素为 True,可以选择沿某个轴进行计算。除非至少有一个元素在 Series 或 DataFrame 的某轴上为 True(或等价值,如非零或非空),否则返回 False。


参数说明
参数名类型默认值描述
axis{0 或 ‘index’, 1 或 ‘columns’, None}0指定要减少的轴。对于 Series,此参数未使用,默认为 0。
- 0 / 'index':减少索引,返回一个 Series,其索引是原始列标签。
- 1 / 'columns':减少列,返回一个 Series,其索引是原始索引。
- None:减少所有轴,返回一个标量值。
bool_onlyboolFalse仅包含布尔类型的列。对于 Series 未实现。
skipnaboolTrue排除 NA/null 值。如果整行/列均为 NA 且 skipna=True,则结果为 False,如同空行/列。如果 skipna=False,NA 被视为 True,因为它们不等于零。
**kwargsanyNone其他关键字参数无实际作用,但可能为了与 NumPy 兼容而接受。

返回值
类型描述
标量或 Series如果指定了 level,则返回 Series;否则返回标量值。

翻译 (Translation)

Description

Series.any(*, axis=0, bool_only=False, skipna=True, **kwargs)
Returns whether any element is True, potentially over an axis. Unless there is at least one element within a Series or along a DataFrame axis that is True (or equivalent, such as non-zero or non-empty), it returns False.


Parameters
ParameterTypeDefaultDescription
axis{0 or ‘index’, 1 or ‘columns’, None}0Specify which axis or axes should be reduced. For Series, this parameter is unused and defaults to 0.
- 0 / 'index': Reduce the index, return a Series whose index is the original column labels.
- 1 / 'columns': Reduce the columns, return a Series whose index is the original index.
- None: Reduce all axes, return a scalar.
bool_onlyboolFalseInclude only boolean columns. Not implemented for Series.
skipnaboolTrueExclude NA/null values. If the entire row/column is NA and skipna=True, then the result will be False, as for an empty row/column. If skipna=False, NA are treated as True, because these are not equal to zero.
**kwargsanyNoneAdditional keywords have no effect but might be accepted for compatibility with NumPy.

Returns
TypeDescription
Scalar or SeriesIf level is specified, then a Series is returned; otherwise, a scalar is returned.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值