-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERR: Remove bitwise operations on dtype=object? #16873
Comments
yeah this is a tough one. We don't normally infer do you want to have a go and see how much impact this would have? IOW add some tests and make a change and see what else breaks? |
I just stumbled across a similar and likely connected error when dealing with boolean data that was for some reason stored with
This is of course rather unexpected, in particular since boolean indexing cannot be used with this result. |
Might be worth mentioning that while
The choice we take for |
Code Sample, a copy-pastable example if possible
Problem description
.shift
and.dropna
are common pandas operations..shift(1) converts dtype from bool to object, so the bitwise operation is applied to each object (~False).
The output in the latter case is extremely surprising. It might be safer to raise an Exception rather than allow bitwise operations implemented on objects.
~pd.Series([1.0], dtype=object)
Expected Output
Exception!
Output of
pd.show_versions()
pandas: 0.19.0
nose: 1.3.7
pip: 9.0.1
setuptools: 35.0.2
Cython: 0.25.1
numpy: 1.10.1
scipy: 0.16.0
statsmodels: 0.6.1
xarray: None
IPython: 5.3.0
sphinx: 1.2.2
patsy: 0.4.0
dateutil: 2.6.0
pytz: 2015.6
blosc: None
bottleneck: None
tables: 3.3.0
numexpr: 2.4.6
matplotlib: 2.0.1
openpyxl: 2.3.3
xlrd: 0.9.4
xlwt: None
xlsxwriter: 0.8.4
lxml: 3.5.0
bs4: 4.5.3
html5lib: 0.999999999
httplib2: 0.9.2
apiclient: 1.4.2
sqlalchemy: 1.0.8
pymysql: None
psycopg2: None
jinja2: 2.9.6
boto: 2.20.1
pandas_datareader: None
The text was updated successfully, but these errors were encountered: