Aug-25-2023, 06:30 PM
You are right. I found there are blank rows at the beginning of the Excel file, Unnamed 0, Unnamed 1, and so on... that is a problem. I thought I could get rid of the "Unnamed" rows and then rename the Headers.
Apparently, that is a huge problem. I tried the following with no good results:
I could probably just convert the Excel file to CSV, and work with it as a text file. Remove blank lines, rename the headers, and completely process it as I wanted, I thought I could do it all in Pandas, but even removing blank rows is a problem. What I'm doing wrong?
Thank you.
Apparently, that is a huge problem. I tried the following with no good results:
exlf = pd.read_excel('C:/01/XLS_Files/SHORT.xlsx', keep_default_na=False) exlf = exlf.dropna(how='all').dropna(axis=1, how='all') exlf = exlf.loc[:, ~exlf.columns.str.contains('^Unnamed')] exlf = exlf.drop('Unnamed: 0', axis=1, inplace=True) exlf = exlf.drop(exlf.filter(regex="Unname"),axis=1, inplace=True)Some of these also remove headers
I could probably just convert the Excel file to CSV, and work with it as a text file. Remove blank lines, rename the headers, and completely process it as I wanted, I thought I could do it all in Pandas, but even removing blank rows is a problem. What I'm doing wrong?
Thank you.