I have dataframe as like follows:
col1 col2 col3 col4
0 a-I - - 12.4
1 - a-I - 2.6
2 a-I - a-I 23
3 - a-I a-I 4
4 - - a-I 5
5 a-I a-I - 6.245
6 - a a 7.23
7 a a - 8
What I want is to check for I in each column if it is present than make res column with splitting string with -. Can anybody have any idea how to do this?
Expected Result would be like this:
col1 col2 col3 col4 res
0 a-I - - 12.4 I
1 - a-I - 2.6 I
2 a-I - a-I 23 I
3 - a-I a-I 4 I
4 - - a-I 5 I
5 a-I a-I - 6.245 I
6 - a a 7.23 -
7 a a - 8 -