2
Good afternoon. I have a question about Python. I have an if where he has the conditional and Else, the Else he processes more than one file and I need to save all the information he reads inside a Dataframe, there is a way to do this?
The code I’m using:
for idx, arquivo in enumerate(fileLista):
if arquivo == 'nome_do_arquivo_para_tratamento':
df1 = pd.read_excel(arquivo, sheet_name = sheetName[idx], skiprows=1)
df1.columns = df1.columns.str.strip()
tratativaUm = df1[[informacoes das colunas que vão ser utilizadas]]
else:
df2 = pd.read_excel(arquivo, sheet_name = sheetName[idx], skiprows=1)
df2.columns = df2.columns.str.strip()
TratativaDois = df2[[informacoes das colunas que vão ser utilizadas]]
####atribuir resultado de cada arquivo recebido no else
frames = [tratativaUm, tratativaDois]
titEmpresa = pd.concat(frames)
Can someone help me ? Thank you