Skip to content

Commit

Permalink
Remove usage of deprecated np.bool and np.long (#1851)
Browse files Browse the repository at this point in the history
* Replace deprecated np.bool with bool in FillMisisng operator

* remove unused numpy import

* Replace np.long with int
  • Loading branch information
oliverholworthy authored Jul 4, 2023
1 parent aa5c25c commit 24136ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions nvtabular/ops/fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.
#
import dask.dataframe as dd
import numpy as np

from merlin.core.dispatch import DataFrameType, annotate
from merlin.dag.ops.stat_operator import StatOperator
Expand Down Expand Up @@ -75,7 +74,7 @@ def column_mapping(self, col_selector):
def _compute_dtype(self, col_schema, input_schema):
col_schema = super()._compute_dtype(col_schema, input_schema)
if col_schema.name.endswith("_filled"):
col_schema = col_schema.with_dtype(np.bool)
col_schema = col_schema.with_dtype(bool)
return col_schema

transform.__doc__ = Operator.transform.__doc__
Expand Down Expand Up @@ -143,5 +142,5 @@ def column_mapping(self, col_selector):
def _compute_dtype(self, col_schema, input_schema):
col_schema = super()._compute_dtype(col_schema, input_schema)
if col_schema.name.endswith("_filled"):
col_schema = col_schema.with_dtype(np.bool)
col_schema = col_schema.with_dtype(bool)
return col_schema
8 changes: 4 additions & 4 deletions nvtabular/tools/data_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ def create_cats(self, size, cats_rep, entries=False):
if col.multi_min and col.multi_max:
if HAS_GPU:
ser = dist.create_col(
col_size + 1, dtype=np.long, min_val=col.multi_min, max_val=col.multi_max
col_size + 1, dtype=int, min_val=col.multi_min, max_val=col.multi_max
)
ser = make_series(np.ceil(ser)).astype(ser.dtype)
_cumsum = xp.cumsum
else:
ser = dist.create_col(
col_size + 1, dtype=np.long, min_val=col.multi_min, max_val=col.multi_max
col_size + 1, dtype=int, min_val=col.multi_min, max_val=col.multi_max
)
ser = make_df(np.ceil(ser))[0]
_cumsum = np.cumsum
Expand All @@ -130,12 +130,12 @@ def create_cats(self, size, cats_rep, entries=False):
offs = offs.astype("int32")
if HAS_GPU:
ser = dist.create_col(
col_size, dtype=np.long, min_val=col.min_val, max_val=col.cardinality
col_size, dtype=int, min_val=col.min_val, max_val=col.cardinality
)
ser = make_series(np.ceil(ser)).astype(ser.dtype)
else:
ser = dist.create_col(
col_size, dtype=np.long, min_val=col.min_val, max_val=col.cardinality
col_size, dtype=int, min_val=col.min_val, max_val=col.cardinality
)
ser = make_df(np.ceil(ser))[0]
ser = ser.astype("int32")
Expand Down

0 comments on commit 24136ef

Please sign in to comment.