Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas dataframe.get_value() function is used to quickly retrieve the single value in the data frame at the passed column and index. The input to the function is the row label and the column label.
Syntax:Â
DataFrame.get_value(index, col, takeable=False)
Parameters:Â
- index : row labelÂ
- col : column labelÂ
- takeable : interpret the index/col as indexers, default FalseÂ
Returns : value : scalar value
For link to CSV file Used in Code, click hereÂ
Example #1: Use get_value() function to find the value of salary in the 10th rowÂ
Python3
# importing pandas as pdimport pandas as pdÂ
# Creating the dataframedf = pd.read_csv("nba.csv")Â
# Print the dataframedf |

Python3
# applying get_value() functiondf._get_value(10, 'Salary') |
Output:

Example #2: Use get_value() function and pass the column index value rather than name. Note : We can also use integer indexer value of columns by setting the takeable parameter=True.Â
Python3
# importing pandas as pdimport pandas as pdÂ
# Creating the dataframedf = pd.read_csv("nba.csv")Â
# column index value of "Name" column is 0# We have set takeable = True# to interpret the index / col as indexerdf.get_value(4, 0, takeable = True) |
Output:

