我有pandas dataframe
float
和object
数据类型。
在resample
...
Blended O2 (PPM) int64
Eng Oil P (PSIG) float64
Reactor T OUT1 (F) float64
Reactor T OUT2 (F) float64
Tank P (Oz/in^2) float64
Stg1 Scrb P (PSIA) float64
Active SD object
delta timedelta64[ns]
dtype: object
resample
...
Blended O2 (PPM) float64
Eng Oil P (PSIG) float64
Reactor T OUT1 (F) float64
Reactor T OUT2 (F) float64
Tank P (Oz/in^2) float64
Stg1 Scrb P (PSIA) float64
dtype: object
当我resample
数据时,object
和timedelta64[ns]
列会被删除。
有解决方法吗?
答案 0 :(得分:0)
找到它。您必须指定how='first'
,否则默认为mean
无法使用非数字数据
df = df.resample('1Min',fill_method='ffill', how='first', limit=5)