Below is my Dataframe format consisting of 2 columns (one is index and other is the data to be cleaned)
0 ans({'A,B,C,Bad_QoS,Sort'})
1 ans({'A,B,D,QoS_Miss1,Sort'})
- I want to remove special characters
- create a data frame for all comma separated items.
I have managed to first remove ans from all rows using:
ds_[col2] = ds_.replace('ans', '', regex=True)
> 0 ({'A,B,C,Bad_QoS,Sort'})
> 1 ({'A,B,D,QoS_Miss1,Sort'})
Then I try to apply replace regex, see below:
ds_['col2'] = ds_['col2'].str.replace( r' \(\{\' | \'\}\) ', '', regex=True)
ds_['col2']
I get no errors, but no changes.
How could I clean these characters and also create a data frame like below:
col1 col2 col3 col4 col5 col6
0 A B C Bad_Qos Sort
1 A B D Qos_Miss1 Sort