Get the First Row of Pandas using values()
This will return the first row in the form of an array. Works similar to iloc(). 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 print (data.values[: 1 ]) # get first row using loc() function print (data.values[: 1 ]) # get particular column print (data[ 'name' ].values[: 1 ]) |
Output:
[[7058 'sravan' 'java']] [[7058 'sravan' 'java']] ['sravan']
How to Get First Row of Pandas DataFrame?
In this article, we will discuss how to get the first row of the Pandas Dataframe