我有以下 df:
0
0 Fuerte venta (0,00)*
1 Infraponderar (0,00)*
2 Neutral (14,00)*
3 Sobreponderar (2,00)*
4 Fuerte compra (11,00)*
我怎样才能将列分成两列以获得以下输出:
0 1
0 Fuerte venta (0,00)*
1 Infraponderar (0,00)*
2 Neutral (14,00)*
3 Sobreponderar (2,00)*
4 Fuerte compra (11,00)*
Use .str.rsplit https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.str.rsplit.html#pandas-series-str-rsplit with expand=True
:
df['0'].str.rsplit(' ', n=1, expand=True)
Output:
0 1
0 Fuerte venta (0,00)*
1 Infraponderar (0,00)*
2 Neutral (14,00)*
3 Sobreponderar (2,00)*
4 Fuerte compra (11,00)*
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)