Add new feature without changing number or rows

Hi ! add_item adds a new row. However what you want is add a new column right ?

To do so, you can use map to perform some calculation and create a new column:


def preprocess(example):
    normalized_col = zscore(example['m1']).tolist()
    return {'m1_normalized': normalized_col}

dataset = Dataset.from_pandas(df).map(preprocess)

map “updates” the dataset, so it’s goign to keep the other columns and add the m1_normalized column