Skip to content

Commit

Permalink
Switch string truediv types to dtypes.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyasr committed May 5, 2021
1 parent de74ae1 commit 15e9458
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
21 changes: 10 additions & 11 deletions python/cudf/cudf/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3307,16 +3307,15 @@ def _reindex(


_truediv_int_dtype_corrections = {
"int8": "float32",
"int16": "float32",
"int32": "float32",
"int64": "float64",
"uint8": "float32",
"uint16": "float32",
"uint32": "float64",
"uint64": "float64",
"bool": "float32",
"int": "float",
np.int8: np.float32,
np.int16: np.float32,
np.int32: np.float32,
np.int64: np.float64,
np.uint8: np.float32,
np.uint16: np.float32,
np.uint32: np.float64,
np.uint64: np.float64,
np.bool_: np.float32,
}


Expand Down Expand Up @@ -3573,7 +3572,7 @@ def _binaryop(
rhs = self._normalize_binop_value(other)

if fn == "truediv":
truediv_type = _truediv_int_dtype_corrections.get(str(lhs.dtype))
truediv_type = _truediv_int_dtype_corrections.get(lhs.dtype.type)
if truediv_type is not None:
lhs = lhs.astype(truediv_type)

Expand Down
1 change: 0 additions & 1 deletion python/cudf/cudf/core/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -2942,7 +2942,6 @@ def as_index(arbitrary, **kwargs) -> Index:


_dtype_to_index: Dict[Any, Type[Index]] = {
bool: Index,
np.int8: Int8Index,
np.int16: Int16Index,
np.int32: Int32Index,
Expand Down

0 comments on commit 15e9458

Please sign in to comment.