Skip to content

teamtomo/mdocfile

Repository files navigation

mdocfile

License PyPI Python Version CI codecov

SerialEM mdoc files as pandas dataframes.

mdocfile is Python package for working with SerialEM mdoc files.


Quickstart

mdocfile.read() will return the contents of an mdoc file as a pandas dataframe.

import mdocfile

df = mdocfile.read('my_mdoc_file.mdoc')

For writing valid mdoc files, please see writing mdoc files.

Installation

pip:

pip install mdocfile

Parsing from text

Mdoc.from_string().as_dataframe() will return the contents of string mdoc data as a pandas dataframe. This is useful for mdoc data that is not stored in a file (e.g. from a database or a web request).

from mdocfile.data_models import Mdoc

mdoc_data = ...

mdoc = Mdoc.from_string(mdoc_data).as_dataframe()