Personal website Rudolf Adamkovič

Home / NumPy


Sampling intervals: np.<arange|linspace>

Evenly spaced:

  • numpy.arange(FIRST = 0, LAST, STEP = 1, dtype=DTYPE)

    Values FIRST to (LAST - STEP) increasing/decreasing by STEP:

    import numpy as np
    a = np.arange(10, 50, 10)
    a
    
    array([10, 20, 30, 40])
    
  • numpy.linspace(FIRST, LAST, COUNT = 50, dtype=float)

    Values FIRST to LAST, equally spaced to COUNT instances:

    import numpy as np
    a = np.linspace(10, 50, 5)
    a
    
    array([10., 20., 30., 40., 50.])
    


© 2025 Rudolf Adamkovič under GNU General Public License version 3.
Made with Emacs and secret alien technologies of yesteryear.