Inconsistent changes of dtype on assignment to multiindexed columns #18415
Labels
32bit
32-bit systems
Bug
Dtype Conversions
Unexpected or buggy dtype conversions
Indexing
Related to indexing on series/frames, not to indexes themselves
MultiIndex
I've found some odd behaviour when assigning to columns with a multiindex. I'm trying to use an array with a float32 dtype, but it's being converted to a float64 dtype under some circumstances. For large arrays this is accompanied by a signifcant slowdown.
So indexing a single column keeps the dtype as float32 (as I would expect), but indexing multiple columns changes it to float64. The behaviour is also different if you write to part of a column (doesn't change) vs a whole column (does change):
If the multiindex is on axis 0 rather than axis 1 then it does not change the dtypes
This odd behaviour only applies to multiindexes:
Finally it also applies to iloc as well as loc:
The text was updated successfully, but these errors were encountered: