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)]
Related Posts:
- TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array
- Import Error: No module named numpy
- ‘End of statement expected’ in pycharm
- For loop and ‘numpy.float64’ object is not iterable error
- How to start from second index for for-loop
- How to fix ‘RuntimeWarning: divide by zero encountered in double_scalars’
- Python 3: Multiply a vector by a matrix without NumPy
- Root mean square of a function in python
- built-in range or numpy.arange: which is more efficient?
- How to install NumPy for Python 3.6
- Use Gif Logo For Loading Screen In Kivy
- How can I make a time delay in Python? [duplicate]
- Python – TypeError: ‘int’ object is not iterable
- ImportError: DLL load failed: The specified module could not be found
- What is the difference between rw+ and r+
- Python – TypeError: ‘int’ object is not iterable
- What exactly does numpy.exp() do? [closed]
- Best way to convert string to bytes in Python 3?
- PermissionError: [Errno 13] Permission denied
- What is setup.py?
- numpy: Invalid value encountered in true_divide
- Invalid character in identifier
- ValueError: Unknown label type: ‘continuous’
- TypeError: unhashable type: ‘numpy.ndarray’
- Convert bytes to a string
- Should I use np.absolute or np.abs?
- Invalid character in identifier
- How to find all occurrences of an element in a list
- TypeError: ‘numpy.float64’ object is not callable
- ‘str’ object has no attribute ‘decode’. Python 3 error?
- Error in Python script “Expected 2D array, got 1D array instead:”?
- How to find all the indexes of a recurring item in a list?
- ‘DataFrame’ object has no attribute ‘sort’
- ValueError: all the input arrays must have same number of dimensions
- How do you use subprocess.check_output() in Python?
- ValueError: setting an array element with a sequence
- filename.whl is not a supported wheel on this platform
- (Help) TypeError: ‘str’ object cannot be interpreted as an integer
- How do order of operations go on Python?
- Why KeyError: 0
- How to raise a numpy array to a power? (corresponding to repeated matrix multiplications, not elementwise)
- Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)
- Pinging servers in Python
- Import error: No module name urllib2
- What does numpy.gradient do?
- ‘list’ object has no attribute ‘shape’
- load csv into 2D matrix with numpy for plotting
- Purpose of `numpy.log1p( )`?
- How to take column-slices of dataframe in pandas
- TypeError(“‘bool’ object is not iterable”,) when trying to return a Boolean
- Get ZeroDivisionError: float division in python
- index 1 is out of bounds for axis 0 with size 1
- Most efficient way to reverse a numpy array
- How to delete last item in list?
- Don’t understand this SyntaxError: illegal target for annotation
- Using Queue in python
- How to normalize a 2-dimensional numpy array in python less verbose?
- “for line in…” results in UnicodeDecodeError: ‘utf-8’ codec can’t decode byte
- SyntaxError invalid token
- How do I format a string using a dictionary in python-3.x?
- Understanding NumPy’s einsum
- What are the causes of overflow encountered in double_scalars besides division by zero?
- python mpl_toolkits installation issue
- RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility
- TypeError: ‘dict_keys’ object does not support indexing
- How to strip all whitespace from string
- Python Binomial Coefficient
- TypeError: Invalid dimensions for image data when plotting array with imshow()
- pythonw.exe or python.exe?
- How to convert ‘binary string’ to normal string in Python3?
- python3 TypeError: ‘function’ object is not iterable
- Moving average or running mean
- Python Error – TypeError: input expected at most 1 arguments, got 3 [duplicate]
- A general tree implementation?
- ModuleNotFoundError: No module named ‘seaborn’ in Python IDE
- Is there a ceiling equivalent of // operator in Python?
- How to plot an array in python?
- How to create a numpy array of all True or all False?
- Removing nan values from an array
- LinAlgError: Last 2 dimensions of the array must be square
- Building multi-regression model throws error: `Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).`
- TypeError: ‘set’ object does not support indexing
- ImportError in importing from sklearn: cannot import name check_build
- pip throws TypeError: parse() got an unexpected keyword argument ‘transport_encoding’ when trying to install new packages
- mean, nanmean and warning: Mean of empty slice
- Replacing Pandas or Numpy Nan with a None to use with MysqlDB
- How to know/change current directory in Python shell?
- What is an easy way to implement fprintf in python?
- How to normalize a NumPy array to within a certain range?
- Sorting arrays in NumPy by column
- Generator expression must be parenthesized if not sole argument
- Does python have header files like C/C++?
- Error: No module named ‘fcntl’
- Python can’t find file
- TypeError: got multiple values for argument
- numpy : calculate the derivative of the softmax function
- IOError: [Errno 32] Broken pipe when piping: `prog.py | othercmd`
- Python webbrowser.open() to open Chrome browser
- Conditional indexing with Numpy ndarray
- python numpy machine epsilon