【发布时间】:2019-11-27 08:52:01
【问题描述】:
我有一个 pandas 数据框,其中包含基于深度的记录数据。深度不规则地间隔开。 我需要以常规的 dx 步骤分隔数据集。
有没有办法做到这一点,而无需将其填充到单独的 numpy 数组中并单独插入它们?
所有列的单独插值。
df=pd.DataFrame(np.array([[0. , 2. , 3.5, 5. , 6. , 18.], [100, 20, 150, 80, 110, 125], [1. , 0.5 , 2.6 , 0.01, 3. , 2.]]).T, columns=['depth', 'value1', 'value2'])
step=0.05
# this is what the column "depth" should be like afterwards
target_depth=np.linspace(df['a'].min(),df['a'].max(),int(df['a'].max()/step))
执行插值/重采样的 pandas 或其他库函数
【问题讨论】:
标签: python pandas resampling