Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #select #row
ADD COMMENT
Topic
Name
8+8 =