Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create numpy array with values in specific range?

How can I create a numpy array which has values in a specific range. For instance only from 2 to 10! I know that np.arrange(10) will create an array with 10 values from 0 to 9 but not sure how to indicate that I want it to have values in a specific range. Any idea? Thanks in advance

like image 271
hispaniccoder Avatar asked Aug 05 '26 06:08

hispaniccoder


1 Answers

As others and the documentation says

np.arange(2,11)

Here is a working example https://repl.it/@Sudakatux/simplenumpy

Here are the docs: https://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html

like image 76
jstuartmilne Avatar answered Aug 07 '26 20:08

jstuartmilne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!