In my research, I have not found a solution that matches the syntax you’ve suggested. Though, that doesn’t surprise me.

Moving columns around in this way is a task that is natural in data management. Python didn’t “grow up” the same way SAS, SPSS, Stata, & R did…

For example, in Stata you’d use a conveition somthin like:

order col1, col9, after(colX)

Also, in Stata you can use wildcards to reference all or some of your varnames. Imagine a dataset with the following columns: var1, var2, var3, other1, other2, other3, idnumber, data1, data2, data3

I could drop all of the other variables with:

drop other*

But, no similar convention (that I know of in Pandas).

Ask about my free career course. I mentor new (💫) and aspiring data scientists enter (🚪) and level up (📈) in the field.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store