今天在网上看到一段代码,其中有~出现,试了一下发现是按位取反的意思,但是注意是在pandas中使用,列表中使用会报错。当然也可以直接将一个数按位取反,具体取反规则可以百度。
ep:
x = pd.Series([True,False])
print(x)
print(~x)
#输出:
0 True
1 False
dtype: bool
0 False
1 True
dtype: bool
今天在网上看到一段代码,其中有~出现,试了一下发现是按位取反的意思,但是注意是在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
网友评论