Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python more order of columns

In [7]: cols = df.columns.tolist()
In [8]: cols
Out[8]: [0L, 1L, 2L, 3L, 4L, 'mean']

In [12]: cols = cols[-1:] + cols[:-1]

In [13]: cols
Out[13]: ['mean', 0L, 1L, 2L, 3L, 4L]
  
In [14]: df = df[cols] 
Comment

PREVIOUS NEXT
Code Example
Python :: call a Python range() using range(start, stop, step) 
Python :: python game engine 
Python :: Write a python program to find the most frequent word in text file 
Python :: pandas change multiple column types 
Python :: python download for ubuntu 20.04 
Python :: python list except last element 
Python :: ignoring warnings 
Python :: pandas df row count 
Python :: ipynb to py online 
Python :: python transpose list of lists 
Python :: make dataframe index a column 
Python :: python import beautifulsoup 
Python :: add text to pygame window 
Python :: set pixel pygame 
Python :: convert a number column into datetime pandas 
Python :: django change user password 
Python :: natural log and log base 10 in python 
Python :: pasal 
Python :: raising exceptions in python 
Python :: python input lowercase 
Python :: convert string to list python 
Python :: python select columns with no na 
Python :: write page source to text file python 
Python :: python take the month of date in new column 
Python :: how to delete all item in treeview tkinter 
Python :: SQLAlchemy query to dict 
Python :: jupyter notebook delete the output 
Python :: what is the use of class in python 
Python :: python random integer in range 
Python :: how to print time python 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =