Skip to content

Commit

Permalink
Make alias for at/iat
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Jul 5, 2024
1 parent 8293be7 commit 97a283c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions python/cudf/cudf/core/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,9 @@ def _setitem_tuple_arg(self, key, value):
self._frame[col].loc[key[0]] = value[i]


_DataFrameAtIndexer = _DataFrameLocIndexer


class _DataFrameIlocIndexer(_DataFrameIndexer):
"""
For selection by index.
Expand Down Expand Up @@ -584,6 +587,9 @@ def _setitem_tuple_arg(self, key, value):
self._frame[col].iloc[key[0]] = value[i]


_DataFrameiAtIndexer = _DataFrameIlocIndexer


class DataFrame(IndexedFrame, Serializable, GetAttrGetItemMixin):
"""
A GPU Dataframe object.
Expand Down Expand Up @@ -2581,14 +2587,14 @@ def iat(self):
"""
Alias for ``DataFrame.iloc``; provided for compatibility with Pandas.
"""
return self.iloc
return _DataFrameiAtIndexer(self)

@property
def at(self):
"""
Alias for ``DataFrame.loc``; provided for compatibility with Pandas.
"""
return self.loc
return _DataFrameAtIndexer(self)

@property # type: ignore
@_external_only_api(
Expand Down
4 changes: 2 additions & 2 deletions python/cudf/cudf/pandas/_wrappers/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,13 +777,13 @@ def Index__new__(cls, *args, **kwargs):

_AtIndexer = make_intermediate_proxy_type(
"_AtIndexer",
_Unusable(),
cudf.core.dataframe._DataFrameAtIndexer,
pd.core.indexing._AtIndexer,
)

_iAtIndexer = make_intermediate_proxy_type(
"_iAtIndexer",
_Unusable(),
cudf.core.dataframe._DataFrameiAtIndexer,
pd.core.indexing._iAtIndexer,
)

Expand Down

0 comments on commit 97a283c

Please sign in to comment.