Skip to content

Commit 24136ef

Browse files
Remove usage of deprecated np.bool and np.long (#1851)
* Replace deprecated np.bool with bool in FillMisisng operator * remove unused numpy import * Replace np.long with int
1 parent aa5c25c commit 24136ef

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

nvtabular/ops/fill.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# limitations under the License.
1515
#
1616
import dask.dataframe as dd
17-
import numpy as np
1817

1918
from merlin.core.dispatch import DataFrameType, annotate
2019
from merlin.dag.ops.stat_operator import StatOperator
@@ -75,7 +74,7 @@ def column_mapping(self, col_selector):
7574
def _compute_dtype(self, col_schema, input_schema):
7675
col_schema = super()._compute_dtype(col_schema, input_schema)
7776
if col_schema.name.endswith("_filled"):
78-
col_schema = col_schema.with_dtype(np.bool)
77+
col_schema = col_schema.with_dtype(bool)
7978
return col_schema
8079

8180
transform.__doc__ = Operator.transform.__doc__
@@ -143,5 +142,5 @@ def column_mapping(self, col_selector):
143142
def _compute_dtype(self, col_schema, input_schema):
144143
col_schema = super()._compute_dtype(col_schema, input_schema)
145144
if col_schema.name.endswith("_filled"):
146-
col_schema = col_schema.with_dtype(np.bool)
145+
col_schema = col_schema.with_dtype(bool)
147146
return col_schema

nvtabular/tools/data_gen.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ def create_cats(self, size, cats_rep, entries=False):
114114
if col.multi_min and col.multi_max:
115115
if HAS_GPU:
116116
ser = dist.create_col(
117-
col_size + 1, dtype=np.long, min_val=col.multi_min, max_val=col.multi_max
117+
col_size + 1, dtype=int, min_val=col.multi_min, max_val=col.multi_max
118118
)
119119
ser = make_series(np.ceil(ser)).astype(ser.dtype)
120120
_cumsum = xp.cumsum
121121
else:
122122
ser = dist.create_col(
123-
col_size + 1, dtype=np.long, min_val=col.multi_min, max_val=col.multi_max
123+
col_size + 1, dtype=int, min_val=col.multi_min, max_val=col.multi_max
124124
)
125125
ser = make_df(np.ceil(ser))[0]
126126
_cumsum = np.cumsum
@@ -130,12 +130,12 @@ def create_cats(self, size, cats_rep, entries=False):
130130
offs = offs.astype("int32")
131131
if HAS_GPU:
132132
ser = dist.create_col(
133-
col_size, dtype=np.long, min_val=col.min_val, max_val=col.cardinality
133+
col_size, dtype=int, min_val=col.min_val, max_val=col.cardinality
134134
)
135135
ser = make_series(np.ceil(ser)).astype(ser.dtype)
136136
else:
137137
ser = dist.create_col(
138-
col_size, dtype=np.long, min_val=col.min_val, max_val=col.cardinality
138+
col_size, dtype=int, min_val=col.min_val, max_val=col.cardinality
139139
)
140140
ser = make_df(np.ceil(ser))[0]
141141
ser = ser.astype("int32")

0 commit comments

Comments
 (0)