Use .iloc
for integer based indexing and .loc
for label based indexing. See below example:
ind_list = [1, 3]
df.iloc[ind_list]
More Related Contents:
- Filter pandas DataFrame by substring criteria
- Adding value labels on a matplotlib bar chart
- Pandas column of lists, create a row for each list element
- Compare two DataFrames and output their differences side-by-side
- Selecting a row of pandas series/dataframe by integer index
- pandas: merge (join) two data frames on multiple columns
- Pandas Extract Number from String
- How do I find numeric columns in Pandas?
- How do I find the closest values in a Pandas series to an input number?
- How to display custom values on a bar plot
- How to drop duplicates based on two or more subsets criteria in Pandas data-frame
- How to normalize json correctly by Python Pandas
- Replace invalid values with None in Pandas DataFrame
- How to show all columns’ names on a large pandas dataframe?
- Pandas monthly rolling operation
- How to select all columns except one in pandas?
- Shift column in pandas dataframe up by one?
- In Pandas, does .iloc method give a copy or view?
- Move non-empty cells to the left in pandas DataFrame
- pandas logical and operator with and without brackets produces different results [duplicate]
- How to json_normalize a column with NaNs
- HDF5 – concurrency, compression & I/O performance [closed]
- Convert Pandas Series to DateTime in a DataFrame
- How to use a conditional statement based on DataFrame boolean value in pandas
- Stacked bar chart in Seaborn
- How to add/subtract time (hours, minutes, etc.) from a Pandas DataFrame.Index whos objects are of type datetime.time?
- How to plot multiple bars grouped
- How to easily share a sample dataframe using df.to_dict()
- Remove substring from column based on another column
- Python: Adding hours to pandas timestamp