Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!