BUG: Interpolate should be more careful with dtypes (original) (raw)
Originally reported as a comment in #6281 Reposting the example from there:
If you start out with a DataFrame like
In [14]: df = DataFrame({'A': [1, 2, np.nan, 4, 5, np.nan, 7], ....: 'C': [1, 2, 3, 5, 8, 13, 21]})
In [15]: df.dtypes Out[15]: A float64 C int64 dtype: object
So one float, one int, with no NaNs in the int. We apply the interpolation method to each block, so it gets applied to the int block/column. The interpolation will generally return a float dtype.
In [18]: df.interpolate(method='cubic', downcast=None).dtypes Out[18]: A float64 C float64 dtype: object