I need to create an array of a large number of elements, everything works fine when the number of elements is <= 1000. If there are more elements, then it is displayed in this form:

[32.78088929 67.80323438 14.94252882 ... 5.25943371 22.08549083 12.54776541] 

Here is the code:

 arr = np.random.triangular(start,mode,end,amount) print(arr) with open("data/array.txt","w", newline='') as out: print(arr,file=out,sep=" ") 

    1 answer 1

    Numpy "saves" you from printing huge arrays. By default, 1000 items are printed - the first 500 and the last 500.

    When saving to files (for this you need to use the Numpy methods: np.save () , np.savetxt () , np.savez () , np.savez_compressed () ) all elements will be saved.

    If desired, the maximum number of elements to be printed can be configured:

     In [67]: np.set_printoptions(threshold=10000) ...: print(np.arange(2000))