Skip to content

Commit 1c7efe5

Browse files
authored
Fix for newer numpy versions (#657)
* Fix tests * Fix pbutils * lint * Revert import change
1 parent 87a7334 commit 1c7efe5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

clients/py/tests/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def compare_dfs(df1, df2, backend):
174174
col2 = df2[name].sort_index()
175175
assert len(col1) == len(col2), \
176176
'{}: column {} size mismatch'.format(backend, name)
177-
if col1.dtype == np.float:
177+
if col1.dtype == float:
178178
ok = np.allclose(col1.values, col2.values)
179179
else:
180180
ok = col1.equals(col2)

clients/py/tests/test_pbutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_encode_df():
2828

2929
df = pd.read_csv('{}/weather.csv'.format(here))
3030
df['STATION_CAT'] = df['STATION'].astype('category')
31-
df['WDF2_F'] = df['WDF2'].astype(np.float)
31+
df['WDF2_F'] = df['WDF2'].astype(float)
3232
msg = pbutils.df2msg(df, labels)
3333

3434
names = [col.name for col in msg.columns]

clients/py/v3io_frames/pbutils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def series2col_with_dtype(s, name, dtype):
232232
elif dtype == fpb.FLOAT:
233233
kw['dtype'] = fpb.FLOAT
234234
kw['floats'] = s
235-
elif dtype == fpb.STRING: # Pandas dtype for str is object
235+
elif dtype == fpb.STRING:
236236
kw['strings'] = s
237237
kw['dtype'] = fpb.STRING
238238
elif dtype == fpb.BOOLEAN:
@@ -263,7 +263,7 @@ def series2col(s, name):
263263
elif is_float(s.dtype):
264264
kw['dtype'] = fpb.FLOAT
265265
kw['floats'] = s
266-
elif s.dtype == np.object: # Pandas dtype for str is object
266+
elif s.dtype == object:
267267
kw['strings'] = s
268268
kw['dtype'] = fpb.STRING
269269
elif is_bool(s.dtype):
@@ -278,7 +278,7 @@ def series2col(s, name):
278278
kw['times'] = s.astype(np.int64)
279279
kw['dtype'] = fpb.TIME
280280
elif is_categorical_dtype(s.dtype):
281-
# We assume catgorical data is strings
281+
# We assume categorical data is strings
282282
kw['strings'] = s.astype(str)
283283
kw['dtype'] = fpb.STRING
284284
else:
@@ -297,7 +297,7 @@ def insert_nulls_based_on_null_values_map(df, null_values):
297297
for col_name in null_values[i].nullColumns:
298298
# boolean columns should be converted to `object` to be able to
299299
# represent None.
300-
if df[col_name].dtype == np.bool and \
300+
if df[col_name].dtype == bool and \
301301
col_name not in casted_columns:
302302
casted_columns[col_name] = True
303303
df[col_name] = df[col_name].astype(object)

0 commit comments

Comments
 (0)