Home » excel » python – How to fix a blank column being added at the far left when reading my excel file?

python – How to fix a blank column being added at the far left when reading my excel file?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I’m working on a rather large excel file and as part of it I’d like to insert two columns into a new excel file at the far right which works, however whenever I do so an unnamed column appears at the far left with numbers in it.

This is for an excel file, and I’ve tried to use the .drop feature as well as use a new file and read about the CSV files but I cannot seem to apply it here, so nothing seems to solve it.

wdf = pd.read_excel(tLoc)

sheet_wdf_map = pd.read_excel(tLoc, sheet_name=None)


wdf['Adequate'] = np.nan
wdf['Explanation'] = np.nan

wdf = wdf.drop(" ", axis=1)

I expect the output to be my original columns with only the two new columns being on the far right without the unnamed column.

How to&Answers:

Add index_col=[0] as an argument to read_excel.