0

I have a record of n columns after some changes the last 3 columns should be on the first three columns how can I change them I know how to swap the columns: title[1],title[2]= title[2],title[1] But I want to change the order of entire column(with values) Foreg: Srno.|FullName|Phone.no|EmailId|City|State|Country|FirstName|MiddleName|Lastname

i want the out put to be

Srno.|FirstName|MiddleName|Lastname|Phone.no|EmailId|City|State|Country

1 Answers1

0

You want to reorder the columns In Excel? If It so then you can refer this code.

df=df[["Srno.","FirstName","MiddleName","Lastname","Phone.no","EmailId","City","State","Country"]]

You can also refer How to change the order of DataFrame columns?

Lokeshwar G
  • 136
  • 6