Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

numpy generate sequence from 0 to n

import numpy as np
n = 10
v1 = np.arange(n) # from 0 (included) to n (excluded) with step 1
v1
>>> array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
start = 5
v2 = np.arange(start, n) # from start to n with step 1
v2
>>> array([5, 6, 7, 8, 9])
s = 2
v3 = np.arange(n, s) # from 0 to n with step 2
>>> array([0, 2, 4, 6, 8])
Comment

PREVIOUS NEXT
Code Example
Python :: Reading from a file way02 
Python :: Access the Response Methods and Attributes in python Show redirections 
Python :: extract a subpart of a matrix 
Python :: max value from multiple columns pandas 
Python :: To install the C++ and Python Messaging APIs: 
Python :: Python Importing module from a package 
Python :: Python Old style formatting 
Python :: how print python 
Python :: Python match.span() 
Python :: pandas replace not working 
Python :: Python - pasword hashed 
Python :: pypi cryptography 
Python :: Python send sms curl 
Python :: how to save a from with createvue django 
Python :: deoplete 
Python :: cv2 jupyter notebook matplotlib inverted colors fix 
Python :: ABA Alphabet pyramid 
Python :: axes in array 
Python :: flask how to initialze extension after start 
Python :: traint test split on column id 
Python :: extending the existing user model 
Python :: for con condicion 
Python :: 1041 uri solution 
Python :: python matrices access column 
Python :: python csv string to array 
Python :: pandas set index integer not float 
Python :: calculate speed with time in datetime python 
Python :: bebražole 
Python :: k means image classification 
Python :: how to access a variable from another py file in vs code 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =