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?
CodePudding user response:
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)