Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

move column in pandas dataframe

column_to_move = df.pop("name")

# insert column with insert(location, column_name, column_value)

df.insert(len(df.columns), "name", column_to_move)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #move #column #pandas #dataframe
ADD COMMENT
Topic
Name
9+2 =