DavidK DavidK - 1 year ago 95
Python Question

How to render visually a big pandas dataframe (~7000 lines, 3 columns)?

I have a big dataframe with values between -1 and 1. The dataframe has almost 7000 lines and 3 columns. I would like to have a visualization without the cells shrinking. For now, it's more lines than cells. I would like the color to refer to the value. I was trying with

but I don't find how to increase the height of cells. I've tried to play with extent and aspect but when aspect is increased, the picture shrinks.

Answer Source

The most compact representation would be to use a bitmap of one pixel per value. This can be accomplished using PIL or Pillow, by creating the image from a buffer of data.

import StringIO
from PIL import Image

im = Image.open(StringIO.StringIO(buffer))

You would have to scale the data in the buffer to one or more bytes per pixel depending on the mode of the image you want to create

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download