【发布时间】:2021-02-14 21:32:38
【问题描述】:
我试图在 Dask 中将 2 个数据帧与浮点类型系列合并(由于内存问题,我不能使用纯 Pandas)。从the post,我发现合并浮点型列时会出现问题。所以我相应地尝试了帖子中的答案,以获得 XYZ 值 * 100 并转换为 int。
x y z R G B
39020.470001199995750 33884.200004600003012 36.445701600000000 25 39 26
39132.740005500003463 33896.049995399996988 30.405698800000000 19 24 18
39221.059997600001225 33787.050003099997411 26.605699500000000 115 145 145
39237.370010400001775 33773.019996599992737 30.205699900000003 28 33 37
39211.370010400001775 33848.270004300000437 32.535697900000002 19 28 25
我做了什么
N = 100
df2.x = np.round(df2.x*N).astype(int)
df2.head()
但是由于这个dataframe没有索引,所以会报错
local variable 'index' referenced before assignment
预期的答案
x y z R G B
3902047 3388420 3644 25 39 26
【问题讨论】:
标签: python pandas numpy dataframe dask