Mar-30-2023, 08:25 PM
(This post was last modified: Mar-31-2023, 05:14 PM by deanhystad.)
Sure. You could use apply() which gives you more freedom in what you can do.
dictionary["Number"] = dictionary["ID"].apply(lambda x: x.split("-")[1])I think it is better to stay with the current solution and either ignore the extra column or drop it.
dictionary.drop(axis=1, labels=["SAMPLE ID"])or
new_dictionary = dictionary[["names", "of", "columns", "i", "want", "to", "keep"]]