Here is what I am trying to do. suppose this is my data column.
0 ET Bureau 1 By Sobia Khan, ET Bureau 2 ET Bureau 3 By Sarita C Singh, ET Bureau 4 By Dipanjan Roy Chaudhury, ET Bureau Here I want to run a loop and select only those values which are having comma separated values, for ex in the above data at index 1 there is a comma separated value and from that value, I need to extract only the string which is after the comma for ex from By Sobia Khan, ET Bureau I need ET Bureau only.
I tried df['column_name'].str.split(',').str[1] but it was giving me nan values for the ones which were not comma separated. So I want to run a loop only for comma separated values.
没有评论:
发表评论