44from collections .abc import Hashable
55import typing
66
7+ import bigframes
78from 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