Skip to content
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

Breaking change multiplication bool and int #22047

Closed
Tux1 opened this issue Jul 25, 2018 · 5 comments · Fixed by #22163
Closed

Breaking change multiplication bool and int #22047

Tux1 opened this issue Jul 25, 2018 · 5 comments · Fixed by #22163
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions
Milestone

Comments

@Tux1
Copy link
Contributor

Tux1 commented Jul 25, 2018

Code Sample, a copy-pastable example if possible

import pandas as pd
a = pd.DataFrame([[False, True], [False, False]])
print(a.dtypes)
b = a * 1
print(b.dtypes)

Problem description

With 0.20.3, I get b as DataFrame int32.
With 0.23.3, I get b as DataFrame object.

Expected Output

With 0.20.3

a.dtypes =
0 bool
1 bool
dtype: object

b.dtypes =
0 int32
1 int32
dtype: object

With 0.23.3

a.dtypes =
0 bool
1 bool
dtype: object

b.dtypes =
0 object
1 object
dtype: object

Versions

pandas 0.20.3 vs pandas 0.23.3

@jbrockmendel
Copy link
Member

What do you get if you multiply a series instead of a dataframe?

@Tux1
Copy link
Contributor Author

Tux1 commented Jul 25, 2018

Don't understand your question
EDIT: I amended my example adding .dtypes. maybe it is clearer for you now

@jorisvandenbossche
Copy link
Member

A Series works infers the dtype correctly:

In [71]: a[0]
Out[71]: 
0    False
1    False
Name: 0, dtype: bool

In [72]: a[0] * 1
Out[72]: 
0    0
1    0
Name: 0, dtype: int64

@Tux1
Copy link
Contributor Author

Tux1 commented Jul 28, 2018

Any idea about the root cause ? If you give me some tips, I can have a look

@jbrockmendel
Copy link
Member

No idea what changed it, but it'll be fixed by the follow-up after #22074.

@jreback jreback added Dtype Conversions Unexpected or buggy dtype conversions Bug labels Aug 14, 2018
@jreback jreback added this to the 0.24.0 milestone Aug 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants