Pretreatment of the sixth day of learning data python

1, a space worthy of deletion: space worth meaning no alignment between the upper and lower data file ,, there is a space, not a vacancy value

from pandas import read_csv;

df = read_csv('D://PA//4.5//data.csv')

newName = df['name'].str.strip();

df['name'] = newName;

  2, delete the missing values

from pandas import read_csv;

df = read_csv('D://PA//4.4//data.csv');

newDF = df.dropna();

  3, delete duplicate worth

from pandas import read_csv;

df = read_csv('D://PA//4.3//data.csv')

newDF = df.drop_duplicates();

  

Guess you like

Origin www.cnblogs.com/manjianlei/p/11266495.html