Build a Python list and convert that to a Numpy array. That takes amortized O(1) time per append + O(n) for the conversion to array, for a total of O(n).
a = []
for x in y:
a.append(x)
a = np.array(a)
More Related Contents:
- How to print the full NumPy array, without truncation?
- What are the differences between numpy arrays and matrices? Which one should I use?
- Convert Python sequence to NumPy array, filling missing values
- Numpy array assignment with copy
- numpy matrix vector multiplication [duplicate]
- How to apply a disc shaped mask to a NumPy array?
- How to remove specific elements in a numpy array
- Repeating each element of a numpy array 5 times
- how does multiplication differ for NumPy Matrix vs Array classes?
- Ambiguity in Pandas Dataframe / Numpy Array “axis” definition
- How to split/partition a dataset into training and test datasets for, e.g., cross validation?
- How to create a numpy array of arbitrary length strings?
- Using Numpy Vectorize on Functions that Return Vectors
- Numpy modify array in place?
- Subsetting a 2D numpy array
- How to normalize a 2-dimensional numpy array in python less verbose?
- What is the difference between ndarray and array in NumPy?
- Numpy individual element access slower than for lists
- How to turn a video into numpy array?
- Can numpy bincount work with 2D arrays?
- Python: slicing a multi-dimensional array
- Sort invariant for numpy.argsort with multiple dimensions
- Numpy isnan() fails on an array of floats (from pandas dataframe apply)
- Concatenate range arrays given start, stop numbers in a vectorized way – NumPy
- Numpy array dimensions
- Numpy – Replace a number with NaN
- Numpy select rows based on condition
- Python: how to store a numpy multidimensional array in PyTables?
- Passing numpy arrays in Cython to a C function that requires dynamically allocated arrays
- Convert list of lists with different lengths to a numpy array [duplicate]