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.
at is used to return data in a dataframe at passed location. The passed location is in the format [poition, Column Name]. This method works in a similar way to Pandas
loc[ ] but
at[ ] is used to return only single value and hence works faster than it.
Syntax: Dataframe.at[position, label]
position: Position of element in column
label: Column name to be used
Return type: Single element at passed position
To download the data set used in following example, click here.
In the following examples, the data frame used contains data of some NBA players. The image of data frame before any operations is attached below.
In this example, A dataframe is created by passing URL of csv to Pandas .read_csv() method. After that 2nd value in Name column is returned using .at[ ] method.
As shown in output image, the output can be compared and it can be seen that the Value at 2nd position in Name column is similar to output.
- Unlike, .loc[ ], This method only returns single value. Hence dataframe.at[3:6, label] will return an error.
- Since this method only works for single values, it is faster than .loc method.
- Python | pandas.to_markdown() in Pandas
- Python | pandas.map()
- Python | Pandas Panel.pow()
- Python | Pandas Panel.mul()
- Python | Pandas Panel.sub()
- Python | Pandas dataframe.all()
- Python | Pandas Series.mod()
- Python | Pandas Dataframe.iat[ ]
- Python | Pandas dataframe.add()
- Python | Pandas Index.contains()
- Python | Pandas DataFrame.abs()
- Python | Pandas Panel.add()
- Python | Pandas Series.where
- Python | Pandas Series.xs
- Python | Pandas Series.loc
- Python | Pandas Series.ix
- Python | Pandas dataframe.div()
- Python | Pandas Series.agg()
- Python | Pandas dataframe.mean()
- Python | Pandas Series.var
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.