The variable mean_data
is a nested list, in Python accessing a nested list cannot be done by multi-dimensional slicing, i.e.: mean_data[1,2]
, instead one would write mean_data[1][2]
.
This is becausemean_data[2]
is a list. Further indexing is done recursively – since mean_data[2]
is a list, mean_data[2][0]
is the first index of that list.
Additionally, mean_data[:][0]
does not work because mean_data[:]
returns mean_data
.
The solution is to replace the array ,or import the original data, as follows:
mean_data = np.array(mean_data)
numpy arrays (like MATLAB arrays and unlike nested lists) support multi-dimensional slicing with tuples.
Related Posts:
- numpy array: IndexError: too many indices for array
- Python3 – ModuleNotFoundError: No module named ‘numpy’
- ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
- Curve curvature in numpy
- Converting NumPy array into Python List structure?
- The difference between comparison to np.nan and isnull()
- ‘numpy.ndarray’ object has no attribute ‘index’
- ImportError: DLL load failed: The specified module could not be found
- Python- Robot Framework Rebot Using List
- Python vs Cpython
- Changing one character in a string
- How can I represent an ‘Enum’ in Python?
- Relative imports – ModuleNotFoundError: No module named x
- Using global variables in a function
- How do I upgrade the Python installation in Windows 10?
- Difference between del, remove, and pop on lists
- How can I install packages using pip according to the requirements.txt file from a local directory?
- How to measure elapsed time in Python?
- Selecting multiple columns in a Pandas dataframe
- not all arguments converted during string formatting.. NO % variables
- TypeError: ‘builtin_function_or_method’ object is not subscriptable
- Python Variable Declaration
- Relative imports in Python 3
- numpy max vs amax vs maximum
- ImportError: No module named sklearn.cross_validation
- “pip install unroll”: “python setup.py egg_info” failed with error code 1
- Converting string into datetime
- ImportError: No module named matplotlib.pyplot
- ImportError: No module named matplotlib.pyplot
- How do I list all files of a directory?
- Accessing the index in ‘for’ loops?
- 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
- 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
- numpy matrix vector multiplication
- How do I read CSV data into a record array in NumPy?
- data type not understood
- ImportError: Missing required dependencies [‘numpy’]
- ImportError: numpy.core.multiarray failed to import
- numpy array concatenate: “ValueError: all the input arrays must have same number of dimensions”
- TypeError: ‘numpy.float64’ object is not callable
- Convert a tensor to numpy array in Tensorflow?
- TypeError: ‘numpy.float64’ object is not callable?
- ‘DataFrame’ object has no attribute ‘sort’
- How to normalize a NumPy array to a unit vector?
- convert nan value to zero
- How can I upgrade NumPy?
- How to get element-wise matrix multiplication (Hadamard product) in numpy?
- Numpy/Python Array Value error
- What is dtype(‘O’), in pandas?
- ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224)
- TypeError: ‘DataFrame’ object is not callable
- Overflow Error in Python’s numpy.exp function
- ValueError: ‘object too deep for desired array’
- LinAlgError: Last 2 dimensions of the array must be square
- What does axis in pandas mean?
- Pytorch tensor to numpy array
- ‘numpy.float64’ object is not iterable
- Python reshape list to ndim array
- Normalize data in pandas
- Can’t broadcast input array from shape (3,1) into shape (3,)
- How do I calculate percentiles with python/numpy?
- deleting rows in numpy array
- ‘list’ object has no attribute ‘shape’
- What is the difference between np.mean and tf.reduce_mean?
- What does ‘index 0 is out of bounds for axis 0 with size 0’ mean?
- ValueError: x and y must be the same size
- Saving a Numpy array as an image
- NumPy List Comprehension Syntax
- How to join on multiple columns in Pyspark?
- Linear regression with matplotlib / numpy
- Numpy extract submatrix
- Numpy float64 vs Python float
- numpy-equivalent of list.pop?
- Using numpy to build an array of all combinations of two arrays
- Can’t update to numpy 1.13 with anaconda?
- Matplotlib: TypeError: can’t multiply sequence by non-int of type ‘numpy.float64’
- TypeError: only integer arrays with one element can be converted to an index 3
- How to add column to numpy array
- Numpy, multiply array with scalar
- Python 3: Multiply a vector by a matrix without NumPy
- How to add a new row to an empty numpy array
- Coalesce values from 2 columns into a single column in a pandas dataframe
- Compute a confidence interval from sample data
- Numpy – add row to array
- How do I compute derivative using Numpy?
- ImportError: cannot import name NUMPY_MKL
- Is there any numpy group by function?
- Mean Squared Error in Numpy?
- Is there a head and tail method for Numpy array?
- Difference between data type ‘datetime64[ns]’ and ‘
- Merging two DataFrames
- Convert a 1D array to a 2D array in numpy
- Transposing a 1D NumPy array
- numpy.float64 object is not iterable…but I’m NOT trying to
- vectorize conditional assignment in pandas dataframe
- Python OpenCV2 (cv2) wrapper to get image size?