Try this. D
in regex stands for non-digit, which includes |
and .
, you would want to explicitly split on |
only. You also need to avoid the first and last bracket using str[1:-1]
raw_data["Array"].str[1:-1].str.split("|",expand=True).add_prefix("setrwds_x")
Tested this out with a dummy series -
#Dummy series
d = ['{58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5}',
'{58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5}',
'{58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5 |58.5}']
dd = pd.Series(d)
out = dd.str[1:-1].str.split("|",expand=True).add_prefix("setrwds_x")
print(out)
setrwds_x0 setrwds_x1 setrwds_x2 setrwds_x3 setrwds_x4 setrwds_x5
0 58.5 58.5 58.5 58.5 58.5 58.5
1 58.5 58.5 58.5 58.5 58.5 58.5
2 58.5 58.5 58.5 58.5 58.5 58.5
setrwds_x6 setrwds_x7 setrwds_x8 setrwds_x9 setrwds_x10 setrwds_x11
0 58.5 58.5 58.5 58.5 58.5 58.5
1 58.5 58.5 58.5 58.5 58.5 58.5
2 58.5 58.5 58.5 58.5 58.5 58.5
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…