Python | Pandas []

Python Methods and Functions

Pandas at† is used to return data in a data frame at the passed location. The location passed is in the format [name, column name]. This method works similarly to Pandas loc [] but at [] is used to return only one value and is therefore faster than that.

Syntax: [position, label]

position: Position of element in column
label: Column name to be used

Return type: Single element at passed position

To download the dataset used in the following example, click here.

In the following examples, the data frame used contains data for some NBA players. An image of the data frame before any operations is attached below. 

Example # 1:
In this example the data frame is created by passing the csv url to the Pandas .read_csv () method. After that, the 2nd value in the Name column is returned using the .at [] method.

# pandas module import

import pandas as pd 

# reading CSV file from URL

data = pd.read_csv ( " "

# create position and label variables

position = 2

label = 'Name'

# method call .at []

output = [position, label]

# display

print (output)

As shown in the output image, the output can be compared and you can see that the value at the 2nd position in the name column is the same as the output. 


  • Unlike .loc [], this method only returns one value. Therefore, [3: 6, label] will return an error.
  • Since this method only works for single values, it is faster than the .loc [] method.

Get Solution for free from DataCamp guru