I have a dataframe,df, where I would like to take the first 3 characters of a string from a specific column and place these characters under another column
Data
id value stat
aaa 10 aaa123
aaa 20
aaa 500 aaa123
bbb 20
bbb 10 bbb123
aaa 5 aaa123
aaa123
ccc123
Desired
id value stat
aaa 10 aaa123
aaa 20
aaa 500 aaa123
bbb 20
bbb 10 bbb123
aaa 5 aaa123
aaa aaa123
ccc ccc123
Doing
df.append({'aaa':aaa123}, ignore_index=True)
I believe I have to append the values, perhaps using a mapping or append function, however, not sure how to specify first 3 characters. Any suggestion is appreciated