Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas select column by index

#    A  B  C
# 0  1  3  5
# 1  2  4  6

column_B = a_dataframe.iloc[:, 1]
print(column_B)

# OUTPUT
# 0    3
# 1    4
Comment

pandas select columns by index list

#select columns with index positions 1 and 3
df.iloc[:, [1, 3]]
Comment

PREVIOUS NEXT
Code Example
Python :: returns the smallest positive integer python 
Python :: python turn off printing 
Python :: python print percent sign 
Python :: python resize image in tkinter 
Python :: check if dataframe contains infinity 
Python :: get all file in folder python 
Python :: python Program for Sum of the digits of a given number 
Python :: add two datetime python 
Python :: instabot login python 
Python :: create new list in for loop python 
Python :: shebang python 
Python :: python check if all caps 
Python :: extend tuple python 
Python :: template string python 
Python :: print groupby dataframe 
Python :: python send http request 
Python :: print map object python 
Python :: numpy inverse square root 
Python :: how to change column name in pandas 
Python :: is number python 
Python :: run powershell script in python 
Python :: assign multiple variables in python 
Python :: Python Requests Library Put Method 
Python :: python subprocess stdout to dev null 
Python :: file base name and extension python 
Python :: python talib install windows 
Python :: convert python datetime to string 
Python :: print() 
Python :: get instance of object python 
Python :: PYTHON 3.0 MAKE A HEART 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =