Home »
Python »
Python Programs
Print a NumPy Array Without Scientific Notation
In this tutorial, we will learn how to print a NumPy array without scientific notation?
By Pranit Sharma Last updated : May 23, 2023
If we want to print the NumPy array of floats, it prints several decimals often in a scientific format which is rather hard to build even for low dimensional arrays, however, the NumPy array apparently has to be printed as a string, we need to find a solution for this.
How to Print a NumPy Array Without Scientific Notation?
To print a NumPy array without scientific notation, You can simply use numpy.set_printoptions() method by passing suppress=True, it will return the NumPy array without scientific notations.
Let us understand with the help of an example,
Python Program to Print a NumPy Array Without Scientific Notation
# Import numpy
import numpy as np
# Creating a numpy array
arr = np.array([1, 5, 10, 20, 35, 5000.5])
# Display original array
print("Orignal array:\n",arr,"\n")
# Using set_printoptions
np.set_printoptions(suppress=True)
# Display Result
print("Result:\n",arr,"\n")
Output
Orignal array:
[1.0000e+00 5.0000e+00 1.0000e+01 2.0000e+01 3.5000e+01 5.0005e+03]
Result:
[ 1. 5. 10. 20. 35. 5000.5]
Python NumPy Programs »