0

I would like to convert this string to a dictionary and then to a dataframe in Python.

string1 = "[{col1: val1,col2: val2,col3: val3,col4: val4}]"

I want the data frame like

col1 col2 col3 col4
val1 val2 val3 val4

Thank you for the feedback, here I am adding what I tried

import ast
ast.literal_eval(string1)
BigDataScientist
  • 1,045
  • 5
  • 17
  • 37

0 Answers0