Skip to content

Commit

Permalink
Merge branch 'main' into bug/df_index_column_pruning_issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Oct 19, 2023
2 parents 63fb58e + 07bef18 commit 46721f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions python/xorbits/_mars/tensor/statistics/bincount.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,10 @@ def bincount(x, weights=None, minlength=0, chunk_size_limit=None):
x = astensor(x)
weights = astensor(weights) if weights is not None else None

if not np.issubdtype(x.dtype, np.int_):
raise TypeError(f"Cannot cast array data from {x.dtype} to {np.dtype(np.int_)}")
if not np.issubdtype(x.dtype, np.int64):
raise TypeError(
f"Cannot cast array data from {x.dtype} to {np.dtype(np.int64)}"
)
if x.ndim != 1:
raise ValueError("'x' must be 1 dimension")
if minlength < 0:
Expand Down
6 changes: 4 additions & 2 deletions python/xorbits/_mars/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,13 +489,15 @@ def calc_data_size(dt: Any, shape: Tuple[int] = None) -> int:
return 0

if isinstance(dt, tuple):
return sum(calc_data_size(c) for c in dt)
# int() for windows CI, otherwise may return numpy.int32 by `sum`
return int(sum(calc_data_size(c) for c in dt))

shape = getattr(dt, "shape", None) or shape
if isinstance(dt, (pd.DataFrame, pd.Series)):
return estimate_pandas_size(dt)
if hasattr(dt, "estimate_size"):
return dt.estimate_size()
# int() for windows CI, otherwise may return numpy.int32
return int(dt.estimate_size()) if dt.estimate_size() is not None else None
if hasattr(dt, "nbytes"):
return max(sys.getsizeof(dt), dt.nbytes)
if hasattr(dt, "shape") and len(dt.shape) == 0:
Expand Down

0 comments on commit 46721f9

Please sign in to comment.