Access a single value for a row/column label pair. If the index is not unique, all matching pairs are returned as an array. Similar to
loc, in that both provide label-based lookups. Use
atif you only need to get a single value in a DataFrame or Series.
Unlike pandas, pandas-on-Spark only allows using
atto get values but not to set them.
row_indexmatches a lot of rows, large amounts of data will be fetched, potentially causing your machine to run out of memory.
When label does not exist in DataFrame
>>> psdf = ps.DataFrame([[0, 2, 3], [0, 4, 1], [10, 20, 30]], ... index=[4, 5, 5], columns=['A', 'B', 'C']) >>> psdf A B C 4 0 2 3 5 0 4 1 5 10 20 30
Get value at specified row/column pair
>>> psdf.at[4, 'B'] 2
Get array if an index occurs multiple times
>>> psdf.at[5, 'B'] array([ 4, 20])