# Breaking change multiplication bool and int #22047

Closed
opened this issue Jul 25, 2018 · 5 comments

Projects
None yet
4 participants
Contributor

### Tux1 commented Jul 25, 2018 • edited

#### 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

Member

### jbrockmendel commented Jul 25, 2018

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

### Tux1 commented Jul 25, 2018 • edited

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

### jorisvandenbossche commented Jul 25, 2018

 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 ``````

### jbrockmendel referenced this issue Jul 25, 2018

Open

#### DataFrame vs Series vs Index arithmetic Roundup #18824

Contributor Author

### Tux1 commented Jul 28, 2018

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

### jbrockmendel commented Jul 28, 2018

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

Merged