-1
I am doing a cross of two sheets in . xslx using the following code:
import pandas as pd
d3 = pd.read_csv(r'C:\Users\t718787\Desktop\Anaconda3 (64-bit)\diretoriox\d3.txt', encoding='latin1', sep=';', names =['0','1','2','3','4','5','6','7', '8', '9', '10', '11', '12', '13', '14'])
d3.to_excel(r'C:\Users\t718787\Desktop\Anaconda3 (64-bit)\diretoriox\d3.xlsx',header=False, index = False )
d3 = d3.rename(columns = {'6' : 'Compromisso'})
d3 = d3.rename(columns = {'8' : 'Remessa'})
i = 0
arqG6 = open(r'C:\Users\t718787\Desktop\Anaconda3 (64-bit)\diretoriox\d5.txt')
colunas = ['compromisso', 'remessa']
dados = []
for line in arqG6:
column = line
if(i == 1):
compromisso = column[5:16]
remessa = column[28:60]
dados.append([compromisso, remessa])
#print('{} , {} '.format(compromisso, remessa))
i = 0
if(column[5:16] == 'COMPROMISSO'):
i = 1
df = pd.DataFrame(dados, columns=colunas)
arqG6.close()
df.to_excel(r'C:\Users\t718787\Desktop\Anaconda3 (64-bit)\diretoriox\d5.xlsx', index = False)
join_cond = (d3['Compromisso'] == df['compromisso']) & (d3['Remessa'] == df['remessa'])
df1 = pd.concat((d3[join_cond], df[join_cond][['teste']]), axis=1)
but in that part
join_cond = (d3['Compromisso'] == df['compromisso']) & (d3['Remessa'] == df['remessa'])
df1 = pd.concat((d3[join_cond], df[join_cond][['teste']]), axis=1)
presents the following error
ValueError: Can only compare identically-labeled Series objects
I looked for some post about, but nothing that helped me.
If possible, don’t just post the code. Complement the answer with an explanation of how and why this code works.
– Lucas Maraal
I tested this excerpt of code and syntax error, could explain better, how would work in the code this excerpt ?
– Indiano11