Skip to content

Commit

Permalink
Fixes Bears-R-Us#2711: Bug in Multindex indexing with bigint values (B…
Browse files Browse the repository at this point in the history
…ears-R-Us#2713)

This PR (fixes Bears-R-Us#2711) adds a check to correctly handle indexing a multi-index with bigint values

Co-authored-by: Pierce Hayes <[email protected]>
  • Loading branch information
stress-tess and Pierce Hayes authored Aug 24, 2023
1 parent 3480c75 commit 768a137
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions arkouda/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,14 +625,16 @@ def __init__(self, values):
self.values = values
first = True
for col in self.values:
# col can be a python int which doesn't have a size attribute
col_size = col.size if not isinstance(col, int) else 0
if first:
# we are implicitly assuming values contains arkouda types and not python lists
# because we are using obj.size/obj.dtype instead of len(obj)/type(obj)
# this should be made explict using typechecking
self.size = col.size
self.size = col_size
first = False
else:
if col.size != self.size:
if col_size != self.size:
raise ValueError("All columns in MultiIndex must have same length")
self.levels = len(self.values)

Expand Down Expand Up @@ -680,6 +682,7 @@ def set_dtype(self, dtype):

def to_ndarray(self):
import numpy as np

return np.array([convert_if_categorical(val).to_ndarray() for val in self.values])

def to_list(self):
Expand Down

0 comments on commit 768a137

Please sign in to comment.