pandas.Index.any#
- Index.any(*args, **kwargs)[源代码]#
返回是否有任何元素为真。
- Parameters:
- *args
与 numpy 兼容性所需。
- **kwargs
与 numpy 兼容性所需。
- Returns:
- bool 或类数组(如果指定了 axis)
单元素类数组可转换为 bool。
参见
Index.all返回是否所有元素都为 True。
Series.all返回是否所有元素都为 True。
Notes
非数字(NaN)、正无穷大和负无穷大都评估为 True,因为它们不等于零。
Examples
>>> index = pd.Index([0, 1, 2]) >>> index.any() True
>>> index = pd.Index([0, 0, 0]) >>> index.any() False