Get the specified row value of a given Pandas DataFrame Last Updated : 17 Aug, 2020 Comments Improve Suggest changes Like Article Like Report Pandas DataFrame is a two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). Now let's see how to get the specified row value of a given DataFrame. We shall be using loc[ ], iloc[ ], and [ ] for a data frame object to select rows and columns from our data frame. iloc[ ] is used to select rows/ columns by their corresponding labels.loc[ ] is used to select rows/columns by their indices.[ ] is used to select columns by their respective names. Method 1: Using iloc[ ]. Example: Suppose you have a pandas dataframe and you want to select a specific row given its index. Python3 # import pandas library import pandas as pd # Creating a dictionary d = {'sample_col1': [1, 2, 3], 'sample_col2': [4, 5, 6], 'sample_col3': [7, 8, 9]} # Creating a Dataframe df = pd.DataFrame(d) # show the dataframe print(df) print() # Select Row No. 2 print(df.iloc[2]) Output: Method 2: Using loc[ ]. Example: Suppose you want to select rows where the value of a given column is given. Python3 # import pandas library import pandas as pd # Creating a dictionary d = {'sample_col1': [1, 2, 1], 'sample_col2': [4, 5, 6], 'sample_col3': [7, 8, 9]} # Creating a Dataframe df = pd.DataFrame(d) # show the dataframe print(df) print() # Select rows where sample_col1 is 1 print(df.loc[df['sample_col1'] == 1]) Output: Method 3: Using [ ] and iloc[ ]. Example: Suppose you want only the values pertaining to specific columns of a specific row. Python3 # import pandas library import pandas as pd # Creating a dictionary d = {'sample_col1': [1, 2, 1], 'sample_col2': [4, 5, 6], 'sample_col3': [7, 8, 9]} # Creating a Dataframe df = pd.DataFrame(d) # show the dataframe print(df) print() # Display column 1 and 3 for row 2 print(df[['sample_col1' , 'sample_col3']].iloc[1]) Output: Comment More infoAdvertise with us Next Article Get the specified row value of a given Pandas DataFrame S suchetaggarwal4 Follow Improve Article Tags : Python Python-pandas Python pandas-dataFrame Practice Tags : python Similar Reads Get a specific row in a given Pandas DataFrame In the Pandas Dataframe, we can find the specified row value with the function iloc(). In this function, we pass the row number as a parameter. The core idea behind this is simple: you access the rows by using their index or position. In this article, we'll explore different ways to get a row from a 5 min read Get Size of the Pandas DataFrame In this article, we will discuss how to get the size of the Pandas Dataframe using Python. Method 1 : Using df.size This will return the size of dataframe  i.e. rows*columns Syntax: dataframe.size where, dataframe is the input dataframe Example: Python code to create a student dataframe and display 2 min read How to sum values of Pandas dataframe by rows? While working on the python pandas module there may be a need, to sum up, the rows of a Dataframe. Below are the examples of summing the rows of a Dataframe. A Dataframe is a 2-dimensional data structure in form of a table with rows and columns. It can be created by loading the datasets from existin 3 min read How to search a value within a Pandas DataFrame row? In this article, we will see how to search a value within Pandas DataFrame row in Python. Importing Libraries and  Data Here we are going to import the required module and then read the data file as dataframe. The link to dataset used is here Python3 # importing pandas as ps import pandas as pd # i 2 min read How to get nth row in a Pandas DataFrame? Pandas Dataframes are basically table format data that comprises rows and columns. Now for accessing the rows from large datasets, we have different methods like iloc, loc and values in Pandas. The most commonly used method is iloc(). Let us consider a simple example.Method 1. Using iloc() to access 4 min read Like