0
tratamento = df.join(de_para.set_index('LINHA'), on='codlinha', lsuffix='_1', rsuffix='_1', how='inner')
tratamento2 = df.join(dexpara.set_index ('DIA'), on='dia', lsuffix='_1', rsuffix='_1', how='inner')                                           
unificado = pd.concat(['tratamento', 'tratamento2'])  
   
unificado.to_excel('C:\\Users\\gabriel.brito\\Desktop\\Teste\\teste2.xlsx')
os.system('C:\\Users\\gabriel.brito\\Desktop\\Teste\\teste2.xlsx')

I try to merge, concat and join but i've failled in everything i tried out. Can anyone help me please?

The script error is down below

TypeError: cannot concatenate object of type '<class 'str'>'; only Series and DataFrame objs are valid

the Syntax "Unificado" is what i've tried to use to unify those 2 informations

enter image description here *Those two informations it what i've looking for, but the data is empty it need to apears related to the datas in the file, if i tried the code "tratamento2" alone the data shows up, but merging those two don't show up. If you guys need more information i'm here.

  • Remove quotes: `unificado = pd.concat([tratamento, tratamento2])`? These are 2 variables and not 2 strings. – Corralien Jan 23 '23 at 19:01
  • it solved 50% but the "DATA" information is empty it only shows the header – Gabriel Rodrigues de Brito - C Jan 23 '23 at 19:04
  • Without a sample of your data, it's hard to understand where is the problem. – Corralien Jan 23 '23 at 19:07
  • Welcome to stack overflow. Please have a look at [How to make good pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) and [edit] your question to include a [mcve] with a sample of your input and your expected output so that we can understand your question – G. Anderson Jan 23 '23 at 19:11

0 Answers0