Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas select row by index

#for single row
df.loc[ index , : ]

# for multiple rows
indices = [1, 20, 33, 47, 52 ]
new_df= df.iloc[indices, :]
Comment

pandas df by row index

indices = [133, 22, 19, 203, 14, 1]
df_by_indices = df.iloc[indices, :]
Comment

PREVIOUS NEXT
Code Example
Python :: Set value of dataframe using condition 
Python :: Python how to use __lt__ 
Python :: datetime.timedelta format to string python 
Python :: scikit learn to identify highly correlated features 
Python :: is python a programming language 
Python :: python lambda key sort 
Python :: pyspark average group by 
Python :: soustraire deux listes python 
Python :: get reactions from message discord.py 
Python :: # enumerate 
Python :: pandas value in series 
Python :: django email change sender name 
Python :: add icon to exe file 
Python :: statsmodels 
Python :: matplotlib pie move percent 
Python :: python os get dir path 
Python :: pygame bg color 
Python :: ImportError: cannot import name include 
Python :: if else in python 
Python :: check if list is in ascending order python 
Python :: seaborn modificar o tamanho dos graficos 
Python :: tkinter mainloop 
Python :: if else pandas dataframe 
Python :: drf serializer general validate method 
Python :: python list as queue 
Python :: how to append two pandas dataframe 
Python :: python write subprocess stdout stderr to file 
Python :: how to sort the order in multiple index pandas 
Python :: isnumeric() in python 
Python :: python relative import 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =