Panel.shift does not respect dtypes 13.1 · Issue #6959 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@dalejung

Description

@dalejung

Because the 13.1 shift uses .values, it will upcast mixed dtypes to object.

import pandas as pd import numpy as np import pandas.util.testing as tm

data = [('item '+ch, tm.makeMixedDataFrame()) for ch in list('abcde')] data = dict(data) mixed_panel = pd.Panel.from_dict(data, orient='minor') shifted = mixed_panel.shift(1) tm.assert_series_equal(mixed_panel.dtypes, shifted.dtypes) #fails

Have PR for this.