Home Parse Postgres array to Python list
Reply: 0

Parse Postgres array to Python list

user711 Published in April 24, 2018, 6:26 am

I have loaded some data into a pandas dataframe from a CSV file, exported from Postgres. One of the columns comes from a PostgreSQL array field, and looks like so (note that it is a string enclosing the array):

    {"keyOne": "valueOne", "keyTwo": "valueTwo"},
    {"keyOne": "valueOne", "keyTwo": "valueTwo"},

Note: the object keys are all double quoted. However, not all of the values are double quoted, as some were originally boolean.

How can I parse this into a Python list with the following form:

      {"keyOne": "valueOne", "keyTwo": "valueTwo"},
      {"keyOne": "valueOne", "keyTwo": "valueTwo"},
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.31907 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO