1import pandas as pd
2pd.set_option('display.max_rows', 500)
3pd.set_option('display.max_columns', 500)
4pd.set_option('display.width', 1000)
1import pandas as pd
2
3#initialize a dataframe
4df = pd.DataFrame(
5 [[21, 72, 67],
6 [23, 78, 62],
7 [32, 74, 56],
8 [73, 88, 67],
9 [32, 74, 56],
10 [43, 78, 69],
11 [32, 74, 54],
12 [52, 54, 76]],
13 columns=['a', 'b', 'c'])
14
15#get first 3 rows
16n=3
17df1 = df.head(n)
18
19#print the dataframe
20print(df1)