out_cols = X.columns.values
cols = []
mapped_columns = []
for switch in mapping:
col = switch.get("col")
mod = switch.get("mapping")
cols.append(col)
X[col] = 0
positive_indexes = mod.index[mod.index > 0]
for i in range(positive_indexes.shape[0]):
After Change
mod = switch.get("mapping")
insert_at = out_cols.index(mod.columns[0])
X.insert(insert_at, col, 0)
positive_indexes = mod.index[mod.index > 0]
for i in range(positive_indexes.shape[0]):
existing_col = mod.columns[i]
val = positive_indexes[i]