-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: boolean frames multiplied by floats have dtypes=object #18549
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
Comments
yeah this looks like it should coerce. would take a PR to fix. |
This seems to be resolved. At least as of f7d162b when I tried to reproduce it. >>> (pd.DataFrame(True, list('ab'), list('cd')) * 1.0).dtypes
c float64
d float64
dtype: object Output of
INSTALLED VERSIONS
commit : f7d162b pandas : 0.26.0.dev0+555.gf7d162b18.dirty |
Would you like to contribute a regression test @Kazz47? |
Looks like in some platforms the bool is being coerced to a int32 rather than the expected int64. Any ideas where this might be happening or how to reproduce it?
|
Guessing there's a routine that's either calling |
I'd guess that it is actually the python integer 1 being coerced to int32 by either numpy or numexpr |
Code Sample, a copy-pastable example if possible
Problem description
A boolean frame multiplied by a float should return a DataFrame of floats to be consistent with python scalar operations (e.g., bool * float -> float). Instead it returns dtypes =
object
.Prior to 0.21.0, I believe this was the case?
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-36-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.21.0
pytest: 3.2.5
pip: 9.0.1
setuptools: 37.0.0
Cython: 0.27.3
numpy: 1.13.3
scipy: 1.0.0
pyarrow: None
xarray: 0.10.0
IPython: 5.5.0
sphinx: None
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: 1.2.1
tables: None
numexpr: 2.6.4
feather: None
matplotlib: 2.1.0
openpyxl: None
xlrd: None
xlwt: 1.3.0
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0b10
sqlalchemy: 1.1.15
pymysql: None
psycopg2: 2.7.3.2 (dt dec pq3 ext lo64)
jinja2: 2.8.1
s3fs: None
fastparquet: None
pandas_gbq: 0.2.0
pandas_datareader: None
The text was updated successfully, but these errors were encountered: