美文网首页
Python Pandas中~波浪符

Python Pandas中~波浪符

作者: 一只当归 | 来源:发表于2019-08-07 09:01 被阅读0次

今天在网上看到一段代码,其中有~出现,试了一下发现是按位取反的意思,但是注意是在pandas中使用,列表中使用会报错。当然也可以直接将一个数按位取反,具体取反规则可以百度。

ep:


x = pd.Series([True,False])
print(x)
print(~x)


#输出:

0    True
1    False
dtype: bool

0    False
1    True
dtype: bool

相关文章

网友评论

      本文标题:Python Pandas中~波浪符

      本文链接:https://www.haomeiwen.com/subject/imendctx.html