vendredi 29 mai 2015

how to delete a duplicate column read from excel in pandas

data in excel, a b a d 1 2 3 4 2 3 4 5 3 4 5 6 4 5 6 7

ipdb> df= pd.io.excel.read_excel(r"sample.xlsx",sheetname="Sheet1") ipdb> df a b a.1 d 0 1 2 3 4 1 2 3 4 5 2 3 4 5 6 3 4 5 6 7

how to delete the column "a.1"? when pandas reads the data from excel it automatically changes the column name of 2nd a to a.1.

I tried df.drop("a.1",index=1) , this does not work.

I have a huge excel file which has duplicate names, and i am interested only in few of columns.

Aucun commentaire:

Enregistrer un commentaire