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 :: python spearman correlation 
Python :: pair plot python 
Python :: how to install python3.6 on ubuntu 
Python :: install python 3.6 ubuntu 16.04 
Python :: calculate the addition of two lists in python 
Python :: python plot jpg image 
Python :: how to re run code in python 
Python :: python pandas how to load csv file 
Python :: python test if value is np.nan 
Python :: select only object columns pandas 
Python :: python hex to bytes string 
Python :: numpy slice array into chunks 
Python :: splittext py 
Python :: python search for string in file 
Python :: yesno django 
Python :: zermelo python 
Python :: python get all characters 
Python :: dataframe x y to geodataframe 
Python :: python scratch cloud variabelen 
Python :: python request example 
Python :: how to plot heatmap in python 
Python :: export a dataframe from rstudio as csv 
Python :: print nested list in new lines 
Python :: python conditional assignment 
Python :: all permutations python 
Python :: cv2.adaptiveThreshold() 
Python :: how to say hello world 
Python :: how to merge dataframe with different keys 
Python :: fetch python 
Python :: how to stop running code in python 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =