更新时间:2022-12-09 12:07:26
有可能,但如果性能很重要,那就不是 好主意:
It is possible, but if performance is important, it is not good idea:
df['range'] = [np.arange(s, e + .5, .5) for s, e in zip(df['x'], df['y'])]
print (df)
x y range
0 0.5 1.5 [0.5, 1.0, 1.5]
1 2.5 3.5 [2.5, 3.0, 3.5]
2 1.5 2.5 [1.5, 2.0, 2.5]
3 4.5 5.5 [4.5, 5.0, 5.5]