Pandas: Ability to scroll through dataframe or series for viewing

Created on 10 Jul 2013  路  9Comments  路  Source: pandas-dev/pandas

I think it would be nice to be able to scroll through a DataFrame by calling whatever scroll function and then holding down the up or down arrow to scroll through the different rows in a series or dataframe and the left and right arrows to scroll across various columns. Currently, it's a little cumbersome to type in different index ranges if you want to quickly look at different parts of a dataframe ala df[0:60], then df[60:120], etc.

Output-Formatting Usage Question

All 9 comments

Maybe a method called page? Want to submit a pr?

Saw this earlier and was thinking of something like:

def page(sliceable, step=10, start=0):
      last = nxt = start
      past_end = False
      while not past_end:
          last, nxt = nxt, nxt + step
          yield sliceable[last:nxt]
          if nxt > len(sliceable):
              past_end = True

Caveat: this was quick and dirty, would need to test to make sure it covers 0 length sliceables and covers the entire end of the array.

@jtratner i like that!

i was thinking something a little different

was thinking you could page through the frame in an actual pager

what u wrote there could be the backend for it, maybe your method could be called chunk then

something like df.page(n) would open a pager in the terminal with the frame

would be equiv to something like df.head(n).chunk(step=1) and show that in the pager
although not sure the chunk is necessary there

but i think it could be a separate issue/feature/pr

related #5611

It's been a while, is there any traction behind this issue? Is this something pandas should support, or is it more the purview of ipython, Jupyter, etc.? There's a related issue that thought it was the latter.

this was for a text paginator, not an html one (which is the purview of ipython/jupyter).

Thanks for clarifying, @jreback.

Use this gist to paginate pandas Dataframe within Jupyter Notebook:
https://gist.github.com/nokados/e8f0a64b55099f2f07a50f2b090c91c7

This seems a little out of scope for pandas now and more suited for jupyter. Closing.

Was this page helpful?
0 / 5 - 0 ratings