Skip to content

Instantly share code, notes, and snippets.

@nipunbatra
Created February 26, 2014 11:21
Show Gist options
  • Save nipunbatra/9227804 to your computer and use it in GitHub Desktop.
Save nipunbatra/9227804 to your computer and use it in GitHub Desktop.
In [112]: sql = "select timestamp, value from data where probe='edu.mit.media.funf.probe.builtin.BatteryProbe'"
In [113]: df = psql.frame_query(sql, con)
In [114]: df.index = pd.to_datetime(df.timestamp, unit='s')
In [115]: df = df.drop("timestamp", 1)
In [117]: ser = df.value.apply(json.loads)
In [120]: ser.values[0]
Out[120]:
{u'health': 2,
u'icon-small': 17303134,
u'invalid_charger': 0,
u'level': 23,
u'plugged': 0,
u'present': True,
u'scale': 100,
u'status': 3,
u'technology': u'Li-ion',
u'temperature': 346,
u'timestamp': 1369294328.444,
u'voltage': 3717}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment