Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas select 2nd row

>>> import pandas as pd
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
>>> df
   col1  col2
0     1     3
1     2     4
>>> df.iloc[[1]]  # DataFrame result
   col1  col2
1     2     4
>>> df.iloc[1]  # Series result
col1    2
col2    4
Name: 1, dtype: int64
Comment

select every second row pandas

df.iloc[::5, :]
Comment

PREVIOUS NEXT
Code Example
Python :: pandas merge on index column 
Python :: check for missing values in pandas 
Python :: write a python program to find table of a number using while loop 
Python :: ipywidget datepicker 
Python :: if elseif in single line python 
Python :: python __init_subclass__ 
Python :: python recurrent timer 
Python :: colorbar min max matplotlib 
Python :: how to convert fahrenheit to celsius in python 
Python :: python find index by value 
Python :: How to remove all characters after character in python? 
Python :: Simple Scatter Plot in matplotlib 
Python :: python comment multiple lines 
Python :: creating a list in python 
Python :: python library to make qr codes 
Python :: pytest multi thread 
Python :: finding the rows in a dataframe where column contains any of these values python 
Python :: python iter on a dic key value 
Python :: discord.py say something 
Python :: how to change plot size in matplotlib 
Python :: plt .show 
Python :: read file into list python 
Python :: how to check an element in a list in python 
Python :: indentation levels in programming 
Python :: cmd check if python is installed 
Python :: count of datatypes in columns 
Python :: aes in python 
Python :: python lock using a file 
Python :: plot second axis plotly 
Python :: difference between __str__ and __repr__ 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =