
1条回答 默认 最新
chuifengde 2021-12-26 17:16关注import pandas as pd df = pd.DataFrame(data = {'height': [167.5, 170], 'weight': [73.8, 61], "BP": ['126/81', '138/92']}) print(df) df[['col1', 'col2']] = df['BP'].str.split("/", n = 1, expand = True) print(df) '''--result height weight BP 0 167.5 73.8 126/81 1 170.0 61.0 138/92 height weight BP col1 col2 0 167.5 73.8 126/81 126 81 1 170.0 61.0 138/92 138 92 '''本回答被题主选为最佳回答 , 对您是否有帮助呢?评论 打赏 举报解决 1无用