Delete a column without header in excel file using python

Viewed 30

Is there any possible way to delete a column without header in excel file using python? I need to delete this enter image description hereheader less column from my data set using python

1 Answers

You can refer to columns by numbers using .iloc[] method. Or in this particular case, you just need df = pandas.read_excel("file.xlsx", index_col=0) with index and df.to_excel("file.xlsx", index=False) without index, that's all. In one line, it will be:

pandas.read_excel("file.xlsx", index_col=0).to_excel("file.xlsx", index=False)
Related