Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit 329a34a

Browse files
author
Ehsan Totoni
committed
fix Series name for dropna
1 parent a0d6c0f commit 329a34a

5 files changed

Lines changed: 17 additions & 10 deletions

File tree

hpat/distributed_analysis.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ def _analyze_block(self, block, array_dists, parfor_dists):
103103
self._analyze_parfor(inst, array_dists, parfor_dists)
104104
elif isinstance(inst, (ir.SetItem, ir.StaticSetItem)):
105105
self._analyze_setitem(inst, array_dists)
106+
# elif isinstance(inst, ir.Print):
107+
# continue
106108
elif type(inst) in distributed_analysis_extensions:
107109
# let external calls handle stmt if type matches
108110
f = distributed_analysis_extensions[type(inst)]

hpat/hiframes/hiframes_typed.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,27 +1168,29 @@ def _run_call_series_dropna(self, assign, lhs, rhs, series_var):
11681168

11691169
nodes = []
11701170
data = self._get_series_data(series_var, nodes)
1171+
name = self._get_series_name(series_var, nodes)
11711172

11721173
if inplace:
11731174
# Since arrays can't resize inplace, we have to create a new
11741175
# array and assign it back to the same Series variable
11751176
# result back to the same variable
1176-
def dropna_impl(A):
1177+
def dropna_impl(A, name):
11771178
# not using A.dropna since definition list is not working
11781179
# for A to find callname
1179-
return hpat.hiframes.api.dropna(A)
1180+
return hpat.hiframes.api.dropna(A, name)
11801181

11811182
assign.target = series_var # replace output
1182-
return self._replace_func(dropna_impl, [data], pre_nodes=nodes)
1183+
return self._replace_func(dropna_impl, [data, name], pre_nodes=nodes)
11831184
else:
11841185
if dtype == string_type:
11851186
func = series_replace_funcs['dropna_str_alloc']
11861187
elif isinstance(dtype, types.Float):
11871188
func = series_replace_funcs['dropna_float']
11881189
else:
11891190
# integer case, TODO: bool, date etc.
1190-
func = lambda A: hpat.hiframes.api.init_series(A)
1191-
return self._replace_func(func, [data], pre_nodes=nodes)
1191+
func = lambda A, name: hpat.hiframes.api.init_series(
1192+
A, None, name)
1193+
return self._replace_func(func, [data, name], pre_nodes=nodes)
11921194

11931195
def _handle_series_map(self, assign, lhs, rhs, series_var):
11941196
"""translate df.A.map(lambda a:...) to prange()

hpat/hiframes/pd_series_ext.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,11 @@ def is_datetime_date_series_typ(t):
147147
@register_model(SeriesType)
148148
class SeriesModel(models.StructModel):
149149
def __init__(self, dmm, fe_type):
150+
name_typ = string_type if fe_type.is_named else types.none
150151
members = [
151152
('data', fe_type.data),
152153
('index', fe_type.index),
153-
('name', string_type),
154+
('name', name_typ),
154155
]
155156
super(SeriesModel, self).__init__(dmm, fe_type, members)
156157

hpat/hiframes/series_kernels.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def _series_fillna_str_alloc_impl(B, fill): # pragma: no cover
5757
hpat.hiframes.api.fillna(A, B, fill)
5858
return hpat.hiframes.api.init_series(A)
5959

60-
def _series_dropna_float_impl(S): # pragma: no cover
60+
def _series_dropna_float_impl(S, name): # pragma: no cover
6161
old_len = len(S)
6262
new_len = old_len - hpat.hiframes.api.init_series(S).isna().sum()
6363
A = np.empty(new_len, S.dtype)
@@ -68,9 +68,9 @@ def _series_dropna_float_impl(S): # pragma: no cover
6868
A[curr_ind] = val
6969
curr_ind += 1
7070

71-
return hpat.hiframes.api.init_series(A)
71+
return hpat.hiframes.api.init_series(A, None, name)
7272

73-
def _series_dropna_str_alloc_impl(B): # pragma: no cover
73+
def _series_dropna_str_alloc_impl(B, name): # pragma: no cover
7474
# local_len to enable 1D_Var dist
7575
# TODO: test
7676
# TODO: generalize
@@ -81,7 +81,7 @@ def _series_dropna_str_alloc_impl(B): # pragma: no cover
8181
A = hpat.str_arr_ext.pre_alloc_string_array(new_len, num_chars)
8282
hpat.str_arr_ext.copy_non_null_offsets(A, B)
8383
hpat.str_arr_ext.copy_data(A, B)
84-
return hpat.hiframes.api.init_series(A)
84+
return hpat.hiframes.api.init_series(A, None, name)
8585

8686
# return the nan value for the type (handle dt64)
8787
def _get_nan(val):

hpat/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ def generic(self, args, kws):
197197

198198
typ_to_format = {
199199
types.int32: 'd',
200+
types.uint32: 'u',
200201
types.int64: 'lld',
202+
types.uint64: 'llu',
201203
types.float32: 'f',
202204
types.float64: 'lf',
203205
}

0 commit comments

Comments
 (0)