You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I updated to version 1.0.1 and the initial issue goes away (i.e. the unary ~ gives the expected result). However, the dtype reverts to object after assignment:
>>>s=pd.Series([True, False, pd.NA], dtype="boolean") # same behavior whether or not you include an `NA`>>>s0True1False2<NA>dtype: boolean>>>~s0False1True2<NA>dtype: boolean>>>s[3] =True>>>s0True1False2<NA>3Truedtype: object>>>~s0-21-12<NA>3-2dtype: object
This may be related to https://github.com/pandas-dev/pandas/pull/31484.
Unary application of the
~
operator seems to operate bitwise on an underlying integer array rather than the expected negation of a boolean:This behavior prevents the correct handling of boolean indexing:
The problem goes away if both of your series are
ExtensionArray
types:Edit
I updated to version
1.0.1
and the initial issue goes away (i.e. the unary~
gives the expected result). However, thedtype
reverts toobject
after assignment:Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.8.1.final.0
python-bits : 64
OS : Darwin
OS-release : 18.7.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.0.0
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 45.1.0.post20200119
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 7.12.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.1.3
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : 1.3.13
tables : None
tabulate : None
xarray : 0.15.0
xlrd : 1.2.0
xlwt : None
xlsxwriter : None
numba : None
The text was updated successfully, but these errors were encountered: