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
- 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
- Understanding the main method of python [duplicate]
- 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+
- Python – TypeError: ‘int’ object is not iterable
- Python3 – ModuleNotFoundError: No module named ‘numpy’
- 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
- Relative imports in Python 3
- numpy max vs amax vs maximum
- What exactly does numpy.exp() do? [closed]
- Best way to convert string to bytes in Python 3?
- 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?
- PermissionError: [Errno 13] in Python
- 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
- 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’
- TypeError: unhashable type: ‘numpy.ndarray’
- Using Python 3 in virtualenv
- 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?
- WinError 2 The system cannot find the file specified (Python)
- numpy matrix vector multiplication
- Converting list to numpy array
- How do I read CSV data into a record array in NumPy?
- hashlib.md5() TypeError: Unicode-objects must be encoded before hashing
- 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
- Could not find a version that satisfies the requirement tensorflow
- data type not understood
- How do you do natural logs (e.g. “ln()”) with numpy in Python?
- Convert bytes to a string
- How do I read CSV data into a record array in NumPy?
- Plotting a 2D heatmap with Matplotlib
- How to normalize a NumPy array to a unit vector?
- How to copy a dictionary and only edit the copy
- How to print like printf in Python3?
- Should I use np.absolute or np.abs?
- Could not find a version that satisfies the requirement tensorflow
- Local variable referenced before assignment?
- What does numpy.random.seed(0) do?
- AttributeError: ‘module’ object has no attribute ‘urlopen’
- ImportError: numpy.core.multiarray failed to import
- Factorial in numpy and scipy
- Python Error: AttributeError: __enter__ [duplicate]
- What does the c underscore expression `c_` do exactly?
- Convert pandas dataframe to NumPy array
- Can’t fix “zipimport.ZipImportError: can’t decompress data; zlib not available” when I type in “python3.6 get-pip.py”
- TypeError: ‘float’ object not iterable
- ImportError: Missing required dependencies [‘numpy’]
- TypeError: ‘type’ object is not subscriptable when indexing in to a dictionary
- Unable to plot Double Bar, Bar plot using pyplot for ndarray
- Error: all the input array dimensions except for the concatenation axis must match exactly
- ‘method’ object is not subscriptable. Don’t know what’s wrong
- Invalid character in identifier
- Importing class from another file [duplicate]