Python 空格值处理
2017-08-17 本文已影响0人
正在充电Loading
from pandas import read_csv
df = read_csv(
'D:\\PDA\\4.5\\data.csv'
)

newName = df['name'].str.lstrip() #清除字符串左边空格变量

newName = df['name'].str.rstrip() #清除字符串右边的变量

newName = df['name'].str.strip()#清除左右字符串变量

df['name'] = newName
