eval-able string representation of pandas objects
pdrepr takes a pandas DataFrame as input, and attempts to output a string that, when passed to Python's built-in
eval(), will reproduce the original DataFrame. Supports multiindices for rows and columns, at least for the relatively
simple cases I have tested. DataFrames with datatypes other than strings, ints and floats should work if their
_repr__() method also returns a string that can be passed to
eval(), resulting in a similar object.
I was tired of having to manually construct DataFrames to be used in testing, especially the reference object to be compared with the resulting DF. With this package, such a code snipped can be created from the resulting DF.
poetry add pdrepr
pipenv install pdrepr
pip install pdrepr
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.