File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -692,7 +692,17 @@ def __getitem__(self, item):
692692 the returned binned sparse matrix will affect the original data.
693693 """
694694 # taken from csr_matrix.__getitem__
695- row , col = self .sparse_matrix ._validate_indices (item )
695+ valid_indices = self .sparse_matrix ._validate_indices (item )
696+ # TODO: The following is a hot fix to compensate an API change in SciPy 1.15 (#653)
697+ # Currently, we cannot set scipy>=1.15 since this would not allow for Python 3.9.
698+ # Once we phase out support for Python 3.9, remove the if statement and the else
699+ # branch and require scipy>=1.15.
700+ if isinstance (valid_indices [0 ], tuple ):
701+ # New version of SciPy (1.15 and later)
702+ row , col = valid_indices [0 ]
703+ else :
704+ # Previous version of SciPy
705+ row , col = valid_indices
696706 spmat = self .sparse_matrix [item ]
697707 if np .isscalar (spmat ):
698708 # data with one element
You can’t perform that action at this time.
0 commit comments