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
- Understanding the main method of python [duplicate]
- Import Error: No module named numpy
- Python3 – ModuleNotFoundError: No module named ‘numpy’
- PermissionError: [Errno 13] in Python
- Error in Python script “Expected 2D array, got 1D array instead:”?
- ‘End of statement expected’ in pycharm
- ‘str’ object has no attribute ‘decode’. Python 3 error?
- 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
- How to draw a line with matplotlib?
- 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+
- Convert bytes to a string
- Python – TypeError: ‘int’ object is not iterable
- ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
- What exactly does numpy.exp() do? [closed]
- numpy: Invalid value encountered in true_divide
- Invalid character in identifier
- LogisticRegression: Unknown label type: ‘continuous’ using sklearn in python
- ValueError: Unknown label type: ‘continuous’
- TypeError: unhashable type: ‘numpy.ndarray’
- Relative imports in Python 3
- Convert bytes to a string
- Should I use np.absolute or np.abs?
- Python Logic of ListNode in Leetcode
- 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
- Convert a tensor to numpy array in Tensorflow?
- 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’
- Proper shebang for Python script
- load csv into 2D matrix with numpy for plotting
- Log to the base 2 in python
- TypeError(“‘bool’ object is not iterable”,) when trying to return a Boolean
- Python – TypeError: Object of type ‘int64’ is not JSON serializable
- Python setup.py develop vs install
- index 1 is out of bounds for axis 0 with size 1
- Most efficient way to reverse a numpy array
- Python 3: UnboundLocalError: local variable referenced before assignment
- How to delete last item in list?
- Don’t understand this SyntaxError: illegal target for annotation
- Using Queue in python
- 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
- 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
- Calculate the Cumulative Distribution Function (CDF) in Python
- 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
- IndexError: index 10 is out of bounds for axis 0 with size 10
- 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
- Where are the ampersand and vertical bar characters used in Python?
- pip throws TypeError: parse() got an unexpected keyword argument ‘transport_encoding’ when trying to install new packages
- Replacing Pandas or Numpy Nan with a None to use with MysqlDB
- Python: What OS am I running on?
- 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++?
- 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
- mport win32ui in python 3.6