Get the First Row of Pandas using loc()
This method is used to get the first row with the index function. Here, we will see the program to get the first row of the dataset
Python3
# import pandas module import pandas as pd # get first row using loc() function data.loc[data.index[ 0 ]] |
Output:
id 7058 name sravan subjects java Name: 0, dtype: object
How to Get First Row of Pandas DataFrame?
In this article, we will discuss how to get the first row of the Pandas Dataframe