GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • w3resource
  • Front End
  • HTML
  • CSS
  • JavaScript
  • HTML5
  • Schema.org
  • php.js
  • Twitter Bootstrap
  • Responsive Web Design tutorial
  • Zurb Foundation 3 tutorials
  • Pure CSS
  • HTML5 Canvas
  • JavaScript Course

This view

  • Original page
  • New address

GeezerVison is showing www.w3resource.com — NumPy: Suppresses the use of scientific notation for small numbers in NumPy array - w3resource

NumPy: Suppresses the use of scientific notation for small numbers in NumPy array

Last update on August 29 2025 12:45:34 (UTC/GMT +8 hours)


Suppress Scientific Notation in Array

Write a NumPy program to suppress the use of scientific notation for small numbers in a NumPy array.

Sample Solution:

Python Code:

# Importing the NumPy library and aliasing it as 'np'
import numpy as np

# Creating a NumPy array 'x' containing floating-point values
x = np.array([1.6e-10, 1.6, 1200, .235])

# Printing a message indicating the original array elements will be shown
print("Original array elements:")

# Printing the original array 'x' with its elements
print(x)

# Printing a message indicating the suppression of scientific notation in the array display
print("Array - scientific notation is suppressed")

# Setting the print options to suppress scientific notation in array printing
np.set_printoptions(suppress=True)

# Printing the array 'x' with scientific notation suppressed
print(x)

Sample Output:

Original array elements:
[1.60e-10 1.60e+00 1.20e+03 2.35e-01]
Print array values with precision 3:
[   0.       1.6   1200.       0.235]

Explanation:

In the above code –

x = np.array([1.6e-10, 1.6, 1200, .235]): Create a NumPy array x containing 4 float values, including a very small number and numbers with different magnitudes.

np.set_printoptions(suppress=True): Set the print options for NumPy arrays, specifying that the scientific notation should be suppressed when displaying the elements.

print(x): Print the NumPy array x.


For more Practice: Solve these Related Problems:

  • Write a NumPy program to display small numbers without scientific notation using np.set_printoptions.
  • Create a function that formats an array to fixed-point notation and verifies that scientific notation is suppressed.
  • Test an array with very small and very large numbers to ensure that the output uses standard decimal notation.
  • Experiment with np.set_printoptions parameters to adjust precision and suppress scientific format for various arrays.

Go to:

  • NumPy Array Exercises Home ↩
  • NumPy Exercises Home ↩

PREV : Display Float Array with Precision
NEXT : Generate 10 Integers from Generator


Python-Numpy Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.


  • Daily Coding Challenges & Projects
  • Weekly Trends and Language Statistics



You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.