Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

180
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda