4

I have a function from a package imported into my Jupyter Notebook. Inside of the function is a print statement that prints a Pandas Dataframe. Let's say I can't (or don't want to) change the code of the function I'm importing. Is there a way to have the Pandas Dataframe being printed to not wrap over in the Jupyter output cell? I.e. how do I make it print on a single line such that I can scroll left to right?

I know about using Jupyter's display function instead of print, but the problem is that the print statement is in the package I'm importing and I can't change the package code.

1
  • Can you paste some example of how you would like to print? Commented Jul 30, 2019 at 2:23

1 Answer 1

6

I believe you can use the set option function inside of Pandas options. I'm not 100% sure this is what you were looking for but this sounds like what you would want to do.

import pandas as pd
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)

Then when you display the code you will see your scroll bar at the bottom of the notebook to go left and right to see the full print statement.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.