5

I have a pandas DataFrame with more than 70 columns.
When I produce a calculation on it, firefox (on windows) has the DataFrame printed in a greater space than the window is allotted for it. I would like the scrollbar to fit inside the ipython window allotted for it. Is there any clean way to handle this?

It can be recreated in firefox using this code in an ipython notebook window.

df = pd.DataFrame(np.random.randn(100, 20))
df.tail()
8
  • What exactly is a dataframe? Are you using pandas?
    – Dux
    Apr 24, 2015 at 15:40
  • yes, I added it for clarity
    – Michael WS
    Apr 24, 2015 at 15:44
  • And your data is printed once you do a calculation? or do you print the result? I'd guess the previous one is specified by DataFrame.__repr__ and the second one by DataFrame.__str__? But I'm no Panda expert at all...
    – Dux
    Apr 24, 2015 at 15:45
  • 2
    You can fix the max col width and the max number of columns to display, alternatively you can do to_html(). So what exactly is it you want to restrict the max width displayed? You can change this using pd.set_option('display.max_width, some_val) and also pd.set_option('display.max_colwidth, some_val), see this for a list of options
    – EdChum
    Apr 24, 2015 at 15:48
  • 1
    It looks like a firefox & ipython interaction problem
    – Michael WS
    Apr 24, 2015 at 16:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.