1、空格值得删除:空格值得意思为数据文件上下之间没有对齐,,存在空格,不是空缺值
from pandas import read_csv; df = read_csv(‘D://PA//4.5//data.csv‘) newName = df[‘name‘].str.strip(); df[‘name‘] = newName;
2、缺失值的删除
from pandas import read_csv; df = read_csv(‘D://PA//4.4//data.csv‘); newDF = df.dropna();
3、重复值得删除
from pandas import read_csv; df = read_csv(‘D://PA//4.3//data.csv‘) newDF = df.drop_duplicates();
原文地址:https://www.cnblogs.com/manjianlei/p/11266495.html
时间: 2024-10-19 10:26:34