Skip to content

Commit f4d64ec

Browse files
committed
update docstring
1 parent 1e5847d commit f4d64ec

File tree

2 files changed

+14
-5
lines changed
  • bigframes/core/indexes
  • third_party/bigframes_vendored/pandas/core/indexes

2 files changed

+14
-5
lines changed

bigframes/core/indexes/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,9 @@ def query_job(self) -> bigquery.QueryJob:
252252
self._query_job = query_job
253253
return self._query_job
254254

255-
def get_loc(self, key):
255+
def get_loc(
256+
self, key: typing.Any
257+
) -> typing.Union[int, slice, "bigframes.series.Series"]:
256258
"""Get integer location, slice or boolean mask for requested label.
257259
258260
Args:

third_party/bigframes_vendored/pandas/core/indexes/base.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from collections.abc import Hashable
55
import typing
66

7+
import bigframes
78
from bigframes import constants
89

910

@@ -741,7 +742,9 @@ def argmin(self) -> int:
741742
"""
742743
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
743744

744-
def get_loc(self, key):
745+
def get_loc(
746+
self, key: typing.Any
747+
) -> typing.Union[int, slice, bigframes.series.Series]:
745748
"""
746749
Get integer location, slice or boolean mask for requested label.
747750
@@ -760,16 +763,20 @@ def get_loc(self, key):
760763
761764
>>> non_monotonic_index = bpd.Index(list('abcb'))
762765
>>> non_monotonic_index.get_loc('b')
763-
array([False, True, False, True])
766+
0 False
767+
1 True
768+
2 False
769+
3 True
770+
dtype: boolean
764771
765772
Args:
766773
key: Label to get the location for.
767774
768775
Returns:
769-
int if unique index, slice if monotonic index with duplicates, else boolean array:
776+
Union[int, slice, bigframes.pandas.Series]:
770777
Integer position of the label for unique indexes.
771778
Slice object for monotonic indexes with duplicates.
772-
Boolean array mask for non-monotonic indexes with duplicates.
779+
Boolean Series mask for non-monotonic indexes with duplicates.
773780
774781
Raises:
775782
KeyError: If the key is not found in the index.

0 commit comments

Comments
 (0)