我想根据以下条件在数据框中添加新列。
我的数据框是这样的:
my_string
2020 test
2020 prod
2020 dev
我的状况:
value1=subtract string after space from my_string
value2=subtract first four digit from my_string
If value 1 contains string 'test' then new_col=value2+"01"
If value 1 contains string 'prod' then new_col=value2+"kk"
If value 1 contains string 'dev' then new_col=value2+"ff"
我需要这样的结果:
my_string | new_col 2020 test | 202001 2020 prod | 2020kk 2020 dev | 2020ff
请有人可以帮我吗?