5 examples of 'python create array' in Python

Every line of 'python create array' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
235def Array(typecode_or_type, size_or_initializer, **kwds):
236 '''
237 Returns a shared array
238 '''
239 from processing.sharedctypes import Array
240 return Array(typecode_or_type, size_or_initializer, **kwds)
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

212def cArray (self, arrTy, arrSize = None):
213 ret_val = {"ty" : "array", "elemty" : arrTy, "array" : arrSize}
214 return ret_val
81def ConstructArray(self, py_arr):
82 ''' note py_arr elems are NOT converted to PyJs types!'''
83 arr = self.NewArray(len(py_arr))
84 arr._init(py_arr)
85 return arr
37def test_construct(self):
38 a = bf.ndarray(self.known_vals, dtype='f32')
39 np.testing.assert_equal(a, self.known_array)
12def create_array():
13 """Creates a simple 3D numpy array with unique values at each
14 location in the matrix.
15
16 """
17 rows, cols, depth = 2, 3, 4
18 arr = numpy.zeros((rows, cols, depth), 'i')
19 count = 0
20 for i in range(rows):
21 for j in range(cols):
22 for k in range(depth):
23 arr[i,j,k] = count
24 count += 1
25 return arr

Related snippets