Perhaps the error message is somewhat misleading, but the gist is that X_train
is a list, not a numpy array. You cannot use array indexing on it. Make it an array first:
out_images = np.array(X_train)[indices.astype(int)]
More Related Contents:
- Change sign of elements with an odd sum of indices
- Python Lists and tuples
- How do you fix “runtimeError: package fails to pass a sanity check” for numpy and pandas?
- Rolling window for 1D arrays in Numpy?
- Windows Scipy Install: No Lapack/Blas Resources Found
- FutureWarning: elementwise comparison failed; returning scalar, but in the future will perform elementwise comparison
- What is vectorization? [closed]
- Calculate average of every x rows in a table and create new table
- Conditionally fill column values based on another columns value in pandas
- Import Error: No module named numpy
- Installing scipy in Python 3.5 on 32-bit Windows 7 Machine
- Transform a set of numbers in numpy so that each number gets converted into a number of other numbers which are less than it
- Python’s sum vs. NumPy’s numpy.sum
- numpy is already installed with Anaconda but I get an ImportError (DLL load failed: The specified module could not be found)
- Why np.hypot and np.subtract.outer very fast compared to vanilla broadcast ? Using Numba for speedup numpy in parallel for distance matrix calculation
- scipy curve_fit doesn’t like math module
- Is there anything faster than dict()?
- Are numpy’s basic operations vectorized, i.e. do they use SIMD operations?
- Type hinting / annotation (PEP 484) for numpy.ndarray
- Error “Import Error: No module named numpy” on Windows
- Finding the nearest value and return the index of array in Python
- How to share numpy random state of a parent process with child processes?
- pandas.read_csv from string or package data
- How to replicate array to specific length array
- Python pandas: how to remove nan and -inf values
- Loading text file containing both float and string using numpy.loadtxt
- AttributeError: module ‘numpy’ has no attribute ‘__version__’
- In sklearn.decomposition.PCA, why are components_ negative?
- Is this the best way to add an extra dimension to a numpy array in one line of code?
- How to postpone/defer the evaluation of f-strings?