Convert Categories Feature to numbers
2021-05-20 13:41 DataBases 阅读(32) 评论(0) 编辑 收藏 举报import pandas as pd
if __name__ == '__main__':
mapping = {
"Class0": 0,
"Class1": 1,
"Class2": 2,
"Class3": 3,
"Class4": 4,
"Class5": 5
}
df = pd.read_csv("../input/train.csv")
# df.loc[:, "catagory"] = df.catagory.map(mapping)
df.loc[:, "catagory"] = df["catagory"].map(mapping)