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?
- SyntaxError: unexpected EOF while parsing
- How to use filter, map, and reduce in Python 3
- Use Gif Logo For Loading Screen In Kivy
- Praw & Discord.py: The bot keep sending the same meme. I want the bot to send different meme whenever it is asked
- How can I make a time delay in Python? [duplicate]
- Python – TypeError: ‘int’ object is not iterable
- How to open a file using the open with statement
- Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)
- ImportError: DLL load failed: The specified module could not be found
- ImportError: DLL load failed: The specified module could not be found
- How to install pip with Python 3?
- What is the difference between rw+ and r+
- Convert bytes to a string
- How can I represent an ‘Enum’ in Python?
- Python – TypeError: ‘int’ object is not iterable
- numpy array: IndexError: too many indices for array
- Relative imports – ModuleNotFoundError: No module named x
- Python: ‘ModuleNotFoundError’ when trying to import module from imported package
- Relative imports – ModuleNotFoundError: No module named x
- ValueError: setting an array element with a sequence
- TypeError: a bytes-like object is required, not ‘str’ when writing to a file in Python3
- How to uninstall a package installed with pip install –user
- ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
- How do I upgrade the Python installation in Windows 10?
- not all arguments converted during string formatting.. NO % variables
- How do I use raw_input in Python 3
- Python Variable Declaration
- Relative imports in Python 3
- Python Math – TypeError: ‘NoneType’ object is not subscriptable
- Curve curvature in numpy
- Relative imports in Python 3
- numpy max vs amax vs maximum
- TypeError: only length-1 arrays can be converted to Python scalars while plot showing
- How can I prevent the TypeError: list indices must be integers, not tuple when copying a python list to a numpy array?
- What exactly does numpy.exp() do? [closed]
- Converting NumPy array into Python List structure?
- working of \n in python [duplicate]
- Pip freeze vs. pip list
- Best way to convert string to bytes in Python 3?
- The difference between comparison to np.nan and isnull()
- Best way to convert string to bytes in Python 3?
- What does the list() function do in Python?
- TypeError: not all arguments converted during string formatting python
- Difference between import numpy and import numpy as np
- PermissionError: [Errno 13] Permission denied
- What is setup.py?
- How is Anaconda related to Python?
- What is the purpose of meshgrid in Python / NumPy?
- why numpy.ndarray is object is not callable in my simple for python loop
- numpy division with RuntimeWarning: invalid value encountered in double_scalars
- FileNotFoundError: [WinError 2] The system cannot find the file specified:
- Numpy ValueError: setting an array element with a sequence. This message may appear without the existing of a sequence?
- numpy: Invalid value encountered in true_divide
- Invalid character in identifier
- python numpy ValueError: operands could not be broadcast together with shapes
- LogisticRegression: Unknown label type: ‘continuous’ using sklearn in python
- Should I put #! (shebang) in Python scripts, and what form should it take?
- How to fix ‘Object arrays cannot be loaded when allow_pickle=False’ for imdb.load_data() function?
- How do I create an empty array/matrix in NumPy?
- Most efficient way to find mode in numpy array
- ValueError: Unknown label type: ‘continuous’
- Should I put #! (shebang) in Python scripts, and what form should it take?
- TypeError: unhashable type: ‘numpy.ndarray’
- Using Python 3 in virtualenv
- Relative imports in Python 3
- How to fix IndexError: invalid index to scalar variable
- How to correct TypeError: Unicode-objects must be encoded before hashing?
- How to remove EOFError: EOF when reading a line?
- Could not install packages due to a “Environment error :[error 13]: permission denied : ‘usr/local/bin/f2py'”
- numpy division with RuntimeWarning: invalid value encountered in double_scalars
- How does numpy.newaxis work and when to use it?
- “If not” condition statement in python
- WinError 2 The system cannot find the file specified (Python)
- numpy matrix vector multiplication
- Converting list to numpy array
- syntaxerror: “unexpected character after line continuation character in python” math
- How do I read CSV data into a record array in NumPy?
- hashlib.md5() TypeError: Unicode-objects must be encoded before hashing
- How can I sort a dictionary by key?
- TypeError: cannot unpack non-iterable NoneType object
- Is there a ‘foreach’ function in Python 3?
- Python inline if statement
- How to install python3 version of package via pip on Ubuntu?
- Updating a dictionary in python