Python Forum
shifting specific column to before/after specific column in dataframe
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
shifting specific column to before/after specific column in dataframe
#1
In dataframe,
a b f g c d e i j h
0 1 1 1 1 1 1 1 1 1 1
1 0 0 1 0 0 1 1 1 1 0
2 1 1 1 1 1 0 0 0 0 1
3 1 0 1 0 0 1 1 1 1 0
4 1 1 1 1 1 0 1 0 0 1
5 1 0 1 0 0 1 1 1 1 0
6 1 1 1 1 1 0 1 0 1 1
7 0 0 0 0 0 0 1 0 1 0
8 1 1 1 1 1 1 1 1 1 1
9 0 0 0 0 0 0 0 0 1 0
10 1 1 1 1 1 1 1 1 1 1


I want to shift these three : 'c','d','e' to the place of after b' and column 'h' to place after 'g'.

My idea is shifting the specific columns to place after/ before specific columns in dataframe for wider purpose . please suggest me! Thanks
Reply


Messages In This Thread
shifting specific column to before/after specific column in dataframe - by theinzawoo - Mar-19-2019, 04:10 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding PD DataFrame column bsben 2 342 Mar-08-2024, 10:46 PM
Last Post: deanhystad
  Get an average of the unique values of a column with group by condition and assign it klllmmm 0 324 Feb-17-2024, 05:53 PM
Last Post: klllmmm
  delete specific row of entries jacksfrustration 3 426 Feb-13-2024, 11:13 PM
Last Post: deanhystad
  Help copying a column from a csv to another file with some extras g0nz0uk 3 501 Feb-01-2024, 03:12 PM
Last Post: DeaD_EyE
  Converting column of values into muliple columns of counts highland44 0 275 Feb-01-2024, 12:48 AM
Last Post: highland44
  Extracting specific file from an archive tester_V 4 556 Jan-29-2024, 06:41 PM
Last Post: tester_V
  Python code to set column width 1418 11 1,377 Jan-20-2024, 07:20 AM
Last Post: Pedroski55
  Why can't I copy and past only ONE specific tab? NewWorldRonin 8 892 Jan-12-2024, 06:31 PM
Last Post: deanhystad
  data validation with specific regular expression shaheen07 0 360 Jan-12-2024, 07:56 AM
Last Post: shaheen07
  Python Alteryx QS-Passing pandas dataframe column inside SQL query where condition sanky1990 0 767 Dec-04-2023, 09:48 PM
Last Post: sanky1990

Forum Jump:

User Panel Messages

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