File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -1985,9 +1985,31 @@ def get_indexer(_i, _idx):
19851985
19861986
19871987def maybe_convert_indices (indices , n ):
1988- """ if we have negative indicies, translate to postive here
1989- if have indicies that are out-of-bounds, raise an IndexError
19901988 """
1989+ Attempt to convert indices into valid, positive indices.
1990+
1991+ If we have negative indices, translate to positive here.
1992+ If we have indices that are out-of-bounds, raise an IndexError.
1993+
1994+ Parameters
1995+ ----------
1996+ indices : array-like
1997+ The array of indices that we are to convert.
1998+ n : int
1999+ The number of elements in the array that we are indexing.
2000+
2001+ Returns
2002+ -------
2003+ valid_indices : array-like
2004+ An array-like of positive indices that correspond to the ones
2005+ that were passed in initially to this function.
2006+
2007+ Raises
2008+ ------
2009+ IndexError : one of the converted indices either exceeded the number
2010+ of elements (specified by `n`) OR was still negative.
2011+ """
2012+
19912013 if isinstance (indices , list ):
19922014 indices = np .array (indices )
19932015 if len (indices ) == 0 :
You can’t perform that action at this time.
0 commit comments