Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

182
Visualizações
pandas pivot_table SQL equivalent

Can we in SQL (preferably Postgresql) mimic the pandas function pivot_table?

For example, let's say we have a table with the following 3 columns:

   Name        Day       Value
   John     Sunday           6
   John     Monday           3
   John     Tuesday          2
   Mary     Sunday           6
   Mary     Monday           4
   Mary     Tuesday          7
   Alex     Tuesday          1

I want to pivot the table so that the index is the name, the columns are the days, and cells are the values:

    names  Monday  Sunday  Tuesday
    John       3       6        2
    Mary       4       6        7
    Alex     null    null       1

Part of the example was taken from the question Transform a 3-column dataframe into a matrix

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda