Let's say I have a panda dataframe like below:
A B C E
iPhone $540 smartphone white,red,black
What I want to do is that, for each row, if a column's value is delimited by a comma, I need to replace the comma with a vertical bar |. Then I want to iterate through the dataframe and modify the row individually:
for index, row in df.iterrows():
pass
I don't know which columns might need this modification beforehand. I need to check the value of each column to see whether they are delimited by a comma. In the example above, the column E needs this operation. Other columns may need this modification too.
Without knowing column name, how to access the value of each row's columns?