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

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

PREVIOUS NEXT
Code Example
Python :: remove specific word from string using python 
Python :: python numphy how to use fractions 
Python :: pandas duplicated rows count 
Python :: django orm count 
Python :: python get item from queue 
Python :: image rotate in python 
Python :: how to create a list in python 
Python :: add time to a datetime object 
Python :: instabot python 
Python :: pyautogui moveTo overtime 
Python :: accept user input in python 
Python :: To View the entire Row and Column in a Dataframe 
Python :: python function as parameter 
Python :: python check string not exist in array 
Python :: how to resize windows in python 
Python :: mongodb get first 10 records 
Python :: make entry bigger in tkinter python 
Python :: how to do a square root in python 
Python :: endswith python 
Python :: length of pandas dataframe 
Python :: how to save the model in python 
Python :: create a python3 virtual environment 
Python :: python test if string begins with python 
Python :: how to make a list string in python 
Python :: creating data frame in python with for loop 
Python :: add css in html django 
Python :: sort series in ascending order 
Python :: if else python 
Python :: NumPy unique Syntax 
Python :: standardise columns python 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =