if orig_plc == Place.meta:
col_data = list(chain(*data[:, orig_var].metas))
else:
col_data = list(chain(*data[:, orig_var]))
if name == orig_var.name and tpe == type(orig_var):
var = orig_var
elif tpe == DiscreteVariable:
values = list(str(i) for i in set(col_data) if not is_missing(i))
After Change
col_data = data[:, orig_var].Y
else:
col_data = data[:, orig_var].X
col_data = col_data.ravel()
if name == orig_var.name and tpe == type(orig_var):
var = orig_var
elif tpe == type(orig_var):
// change the name so that all_vars will get the correct name
orig_var.name = name
var = orig_var
elif tpe == DiscreteVariable:
values = list(str(i) for i in np.unique(col_data) if not is_missing(i))
var = tpe(name, values)
col_data = [np.nan if is_missing(x) else values.index(str(x))
for x in col_data]
elif tpe == StringVariable and type(orig_var) == DiscreteVariable:
var = tpe(name)
col_data = [orig_var.repr_val(x) if not np.isnan(x) else ""
for x in col_data]
else:
var = tpe(name)
places[place].append(var)