Tuesday, June 13, 2017

Pandas DataFrame pretty print

Recently while trying to output dataframe as a part of my logging process, I saw that dataframe, while being relatively small, was broken down over several lines... For ease of the log reading, I wanted to "pretty print" that dataframe.

I end up specifying max width option that allowed for desired output.

    pd.set_option('display.width', 1000)
    print meta_data
    pd.reset_option('display.width')

No comments:

Post a Comment