1. Andrew Davison
  2. sumatra
  3. Pull requests

Pull requests

#28 Merged at 7f9e8a9

Support for more direct JSON export of records

  1. Maximilian Albert

These are some first steps towards easier filtering of records based on parameter values, tags, etc. I have a few ideas for further features and improvements, but it will probably take a while before I can work on them, so I thought I'd submit this in the current state. Feel free to merge if you think this is going in the right direction, otherwise I'm happy to accept comments and refactor it.

The main benefit of this is probably that it allows a more direct JSON export of records which can be used to create a pandas.DataFrame (in the spirit of Issue #196 and [1]). For example, with these changes one can say:

from sumatra.projects import load_project
import pandas
proj = load_project()
records_json = proj.format_records('json')
df = pandas.DataFrame(json.loads(records_json))

It would be nice to have a method somwehere in Project which directly returns a pandas.DataFrame containing a list of records, but I wasn't sure about the most natural place to add this (for example, should it be a separate method or an additional option for an existing method?), so I've left it out for now.

[1] http://nbviewer.ipython.org/github/wd15/smt-demo/blob/master/demo.ipynb

  • Issues #196: Export record store as Pandas dataframe new

Comments (2)

    1. Maximilian Albert author

      I like this because it's a minimal change and quite intuitive if you know about it. The only concern I have is that if I was searching for a pandas export as a user, I would not necessarily expect to find it in a call to format_records() because the name of that function seems to imply that the return value is some sort of string/plain text object (and this is true for all formatting options so far). But I'm happy to add it if you think that's not a problem.