Error Pivot pandas Tables celuas merged

Asked

Viewed 32 times

1

Hello, I have a table in pandas and need to transform, I believe using the pivot, from a certain column

 Month  Codigo       COD 1       COD 2
 0      NaN  Date 1  07/05/2018  01/01/2019
 1      NaN  Date 2         NaN         NaN
 2  05/2018     0.9         0.9         NaN
 3  06/2018       1           1         NaN
 4  07/2018       1           1         NaN

I would like that Tabe to have the following output

inserir a descrição da imagem aqui

I tried the code

 pd.pivot_table(all_data, values = 'COD 1', index=['Codigo'], columns = 'Month').reset_index()

But returns the following error:

DataError: No numeric types to aggregate

This is the link to my excel, in case you want to take a look

https://1drv.ms/x/s! Aodywrtlrltjof-fmNEAFX755uuu? e=1Jam2o

  • I put the link, thank you

  • you only use values when you need to make some kind of aggregation. No need in your case

  • But how do I do the command? because I tried to remove it and am still in error, is it simply remove values? can you please give me an example? Removing values, the error is the same Dataerror: No Numeric types to Aggregate

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.