Python Forum
Transforming data with a partial transpose
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Transforming data with a partial transpose
#1
Hello,

I have a requirement of transposing my data partially

Here is the sample Input & output I am looking for..

Pid Mkdn Date Clr Sls$ Mkdn $
1 14-Apr 100 10
1 22-Apr 200 20
1 28-Apr 300 30
2 14-Apr 100 10
2 22-Apr 200 20
2 28-Apr 300 30
3 14-Apr 100 10
3 22-Apr 200 20
3 28-Apr 300 30


Pid Mkdn Date Metric Name Value
1 14/4 Clr Sls$ 100
1 22/4 Clr Sls$ 200
1 28/4 Clr Sls$ 300
1 14/4 Mkdn$ 10
1 22/4 Mkdn$ 20
1 28/4 Mkdn$ 30
2 14/4 Clr Sls$ 100
2 22/4 Clr Sls$ 200
2 28/4 Clr Sls$ 300
2 14/4 Mkdn$ 10
2 22/4 Mkdn$ 20
2 28/4 Mkdn$ 30
3 14/4 Clr Sls$ 100
3 22/4 Clr Sls$ 200
3 28/4 Clr Sls$ 300
3 14/4 Mkdn$ 10
3 22/4 Mkdn$ 20
3 28/4 Mkdn$ 30
Reply
#2
what have you tried, please show code
Reply
#3
I am new to Python, so I just have thought process.. I was just thinking.. extract each column ,make it repeat the number of times as per the product of (count of dates & number of metrics-> in this case 2 metrics, Clr Sls$, Mkdn$) for a particular Pid, then repeat the dates similarly, and then integrate the columns or something.. Please guide me on the thought process.. May be not code for now..
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  partial functions before knowing the values mikisDeWitte 4 597 Dec-24-2023, 10:00 AM
Last Post: perfringo
  Move Files based on partial Match mohamedsalih12 2 810 Sep-20-2023, 07:38 PM
Last Post: snippsat
  Partial KEY search in dict klatlap 6 1,262 Mar-28-2023, 07:24 AM
Last Post: buran
  remove partial duplicates from csv ledgreve 0 784 Dec-12-2022, 04:21 PM
Last Post: ledgreve
  Webhook, post_data, GPIO partial changes DigitalID 2 984 Nov-10-2022, 09:50 PM
Last Post: deanhystad
  Optimal way to search partial correspondence in a large dict genny92c 0 998 Apr-22-2022, 10:20 AM
Last Post: genny92c
  Partial Matching Rows In Pandas DataFrame Query eddywinch82 1 2,365 Jul-08-2021, 06:32 PM
Last Post: eddywinch82
  Transpose a dataset in pandas simhadriraju 1 1,437 Oct-16-2020, 10:44 AM
Last Post: simhadriraju
  Partial key lookup in dictionary GaryNR 1 3,443 Jul-16-2020, 06:55 PM
Last Post: Gribouillis
  Partial using Tkinter function chesschaser 10 6,759 Jul-03-2020, 03:57 PM
Last Post: chesschaser

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020