Nov-07-2018, 09:54 PM
I have this text file:
LEU,LEID,PPP,YYY,LEO
'1','2','3','4','5'
'2','1','2','3','4'
'2','AA','','',''
I want to delete the rows where for LEID='1'
I wrote this code:
LEU,LEID,PPP,YYY,LEO
'1','2','3','4','5'
'2','1','2','3','4'
'2','AA','','',''
I want to delete the rows where for LEID='1'
I wrote this code:
import pandas as pd #import numpy import os originalFile=os.path.abspath("D:\\python\\test\\OriginalFile.csv") df = pd.read_csv(originalFile) #df.drop(df.LEID == '1') df=df[df.LEID != '1'] df.to_csv('D:\\python\\test\\CorrectedFile.csv') print (df)Why the row with LEID='1' is not delted?