0

R's tidyverse offers the function relocate() to move columns from in specific positions (e.g., df %>% relocate("col1", .after="col2"). Is there a way to do this in Python Pandas, even better with a method?

baggiponte
  • 547
  • 6
  • 13
  • 1
    There are `pop` and `insert` methods, but you will need to call them manually. – Quang Hoang Oct 22 '21 at 14:03
  • I can’t say for certain, however maybe the `move` function in pyjanitor may be helpful as well. They are just convenient wrappers around pandas functions. – sammywemmy Oct 22 '21 at 19:53

0 Answers0