Q. How can we print specific number of rows using dataframes?


Answer :-

• LOC METHOD

df.loc[row, column]

• For first row and all column

df.loc[0,:]

• For first row and some specific column

df.loc[0,'column_name']

• iLOC METHOD
For first row and all column

df.iloc[0,:]

• For first row and some specific column i.e first three cols

df.iloc[0,0:3]

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post