0

I want to display the output of a numpy array in PyCharm such that the output is printed on a single line. So I don't want that the output characters are split up into two lines as the example below. I want all the characters of the numpy array on the same line. Not like below:

[ 0.  0.  0.  0.  0.  1.  0.  0.  0.  0.  1.  0.  0.  0.  0.  0.  1.  0. 0.  0.  0.  0.  0.  1.
0.  0.  0. -1.  0.  0.]
 [ 0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  1.  0.  0. -1.  1.  0.  0.  0. 0.  0.  0.  0.  0.  1.
0.  1.  0.  0.  0.  0.]
 [ 0.  0.  0.  0.  1.  0.  0. -1.  0.  1.  0.  0.  0.  0.  0.  0.  0.  0. 0.  0.  0.  0.  1.  0.
0.  0.  1.  0.  0.  0.]
 [-1.  0.  0.  0.  0.  0.  0.  0.  0.  1.  0.  0.  0.  0.  0.  0.  0.  0. 0.  0.  1.  0.  1.  0.
1.  0.  0.  0.  0.  0.]

How can I do this? What command, which setting?

enter image description here

1
  • 1
    This isn't a pycharm issue, but a display option in Numpy (& pandas). You can change these to fit your needs. Details in my answer. Commented Jan 11, 2023 at 1:05

1 Answer 1

1

If I am not mistaken, you can use this to increase the width of your display, for Pandas and Numpy. Do try these -

For Numpy

import numpy as np
np.set_printoptions(edgeitems=10, linewidth=400)

For Pandas

import pandas as pd
pd.set_option('display.width', 400)
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! The numpy command did the trick.

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.