# -*- coding: utf-8 -*-
#strip函数作用:清除字符型数据左右的空格。
#strip函数语法:strip
from pandas import read_csv
df = read_csv("D:/python/workspace/pythonStudy/10.csv")
newName = df['key'].str.lstrip() #去除左边的空格
newName = df['key'].str.rstrip() #去除右边的空格
newName = df['key'].str.strip() #去除两边的空格
df['key'] = newName #替换以前的列
数据处理之去除空格
最新推荐文章于 2023-06-16 17:00:20 发布
1267

被折叠的 条评论
为什么被折叠?



