Examples

In [1]:
import numpy as np
import pandas as pd
In [2]:
df = pd.DataFrame({'animal':['snake', 'bat', 'tiger', 'lion',
                   'fox', 'eagle', 'shark', 'dog', 'deer']})
df
Out[2]:
animal
0 snake
1 bat
2 tiger
3 lion
4 fox
5 eagle
6 shark
7 dog
8 deer

Pandas: DataFrame - Head.

Viewing the first 5 lines

In [3]:
df.head()
Out[3]:
animal
0 snake
1 bat
2 tiger
3 lion
4 fox

Pandas: DataFrame - Viewing the first 5 lines.

Display the first n lines (three in this case):

In [4]:
df.head(3)
Out[4]:
animal
0 snake
1 bat
2 tiger