replace single quote to double quote python pandas dataframe

I want to replace single quote(‘) to double quote(“) to make it proper json column value in python dataframe.

e.g. csv file looks like…

Unit Id Batch Id                               Items prod
A108    qa120  {'A': 123, 'B': 342, 'C': 454}   
P258    re015  {'A': 124, 'B': 234, 'C': 343} 

I’m reading these values from csv to pandas dataframe. I tried several ways, but no luck.

df.replace("'",'"',inplace=True)
df.[''].str.replace(r"[\',]",'"')
df = df[''].str.replace(r"[\',]",'"')

Thanks for your help in advance.

Read more here: Source link