Jump to content
Fórum Script Brasil
  • 0

Normalizar tabela pandas python


twwister8889
 Share

Question

Boa tarde,

Estou tentando normalizar uma tabela no python, vinda do excel com celulas mescladas mas estou com dificuldades, já usei o melt, agora estou num ponto que não estou conseguindo com o pivot table
 
Essa é a tabela
                  Date     CODE   Teste               Values
         0         NaT  Date a1  CODE 1  2018-05-07 00:00:00
         1         NaT  Date a2  CODE 1                  NaN
         2  2020-08-01       XX  CODE 1                   10
         3  2020-09-01        Y  CODE 1                   20
         4  2020-10-01       ZZ  CODE 1                   30
         5  2020-11-01       WW  CODE 1                   40
         6  2020-12-01       TT  CODE 1                   50
         7         NaT  Date a1  CODE 1           07/05/2018
         8         NaT  Date a2  CODE 1                  NaN
         9  2020-08-01      100  CODE 1                    1

 

esse é o resultado esperado

 

 

 Date        CODE   Teste   Date a1            Date a2  Value
 01/08/2020  XX     CODE 1  07/05/2018 00:00            10
 01/08/2020  100    CODE 1  07/05/2018                  1

 

 
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.1k
    • Total Posts
      647k
×
×
  • Create New...