0

i have a df with 50 columns and it keeps increasing every week. and i have a format in which the data to be presented how do i that without hard coding.

ex: imagine below are the columns

'rma_number','serial_number','RCI_Owner','part_number','model','rma_receipt_date','Repair Open Date','Preliminary Root Cause Date','Preliminary Root Cause TAT',
        'Impact Assessment Date','Impact Assessment TAT','Investigation Date','Investigation TAT','CAPA Open Date','CAPA Plan TAT','CAPA Review Date','CAPA Review TAT','CAPA Implementation Date','CAPA Closed Date',
        'CFAR YES/NO','RCI ECD','location','Current_RCI_Status','Current_Repair_Status','CSR','Conclusion_1',
              'Conclusion_2', 'Conclusion_3', 'Conclusion_4', 'Conclusion_5',
              'Conclusion_6', 'Conclusion_7', 'Conclusion_8','Action_1', 'Action_2',
              'Action_3','activity1', 'activity2', 'activity3', 'activity4',
               'activity5', 'activity6','proposed_date_1', 'proposed_date_2','proposed_date_3', 'proposed_date_4', 'proposed_date_5',
              'proposed_date_6','owner_1', 'owner_2', 'owner_3', 'owner_4',
              'owner_5', 'owner_6','date_of_completion_1', 'date_of_completion_2',
              'date_of_completion_3', 'date_of_completion_4', 'date_of_completion_5',
              'date_of_completion_6'

what I want to do is every time new column appears I want to add that to its place like example 'owner_6','date_of_completion_7'is the new column I want that appear next to owner 5 and date of completion 6

Kris
  • 8,680
  • 4
  • 39
  • 67
vidathri
  • 101
  • 1
  • 9
  • If I search `[pandas] reorder columns` on this website, I get a lot of hits, most notably this one, which has an answer with over 12,000 votes: https://stackoverflow.com/questions/13148429/how-to-change-the-order-of-dataframe-columns/13148611#13148611 – Paul H Nov 07 '22 at 05:08
  • @PaulH its 1200. – Deepak Tripathi Nov 07 '22 at 05:26

0 Answers0