6

I want to print the dataframe and plots in the order as in the code in my jupyter notebook:

  • df
  • plot
  • df
  • plot

Currently, they are printed as:

  • df
  • df
  • plot
  • plot
from IPython.display import display
import matplotlib.pyplot as plt

df = pd.DataFrame({'x': range(5), 'y': range(5)})

for i in range(2):
    display(df)
    display(df.plot())

enter image description here

1 Answer 1

9

Force plt.show after you plot:

for i in range(2):
    display(df)
    df.plot()
    plt.show()
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.