有没有办法改变这个数据帧:
40 4.5 95
41 1.76 95
112 0.17/0.43 >95/>95
使用pandas:
40 4.5 95
41 1.76 95
112 0.17 95
112 0.43 95
这是pandas数据框架:
a b
19 560 80
40 4.5 95
41 1.76 95
112 0.17/0.43 >95/>95
154 7.2/1 >95/>95
... ... ...
2991 55 95
2992 33 95
3887 6.1 87.7
3893 3.9 70.3
3908 100 40
216 rows × 2 columns
我将使用explode
:
df = df.apply(lambda x: x.astype(str).str.split('/').explode(ignore_index=True))