import pandas as pd
employees = pd.read_excel('D:/Code/.vscode/Employees.xlsx',index_col='ID')
df = employees['Full Name'].str.split(expand=True)
employees['First Name'] = df[0]
employees['Last Name'] = df[1].str.upper()
# print(df)
print(employees)
df = employees[‘Full Name’].str.split(expand=True)
可以给定参数确定分隔符和保留分隔字符串的个数,
如df = employees[‘Full Name’].str.split("",expand=True)
以空格进行切分,默认以Tab分割
如df = employees[‘Full Name’].str.split(n=2,expand=True)
.str.upper() 转换为大写的