Python Pandas中~波浪符
2019-08-07 本文已影响0人
一只当归
今天在网上看到一段代码,其中有~出现,试了一下发现是按位取反的意思,但是注意是在pandas中使用,列表中使用会报错。当然也可以直接将一个数按位取反,具体取反规则可以百度。
ep:
x = pd.Series([True,False])
print(x)
print(~x)
#输出:
0 True
1 False
dtype: bool
0 False
1 True
dtype: bool