Why does `False in pandas.Series([True,True])` return True?

前端 未结 3 1394
臣服心动
臣服心动 2021-01-22 13:13
False in [True,True]

False in pd.Series([True,True])

the first line of code returns False the second line of code returns True!

I think I must

3条回答
  •  温柔的废话
    2021-01-22 13:36

    >>> help(pd.Series([True, True]).__contains__)
    Help on method __contains__ in module pandas.core.generic:
    
    __contains__(key) method of pandas.core.series.Series instance
        True if the key is in the info axis
    
    >>> pd.Series([True, True])
    0    True
    1    True
    dtype: bool
    
    ^
    info axis
    

提交回复
热议问题