This is a classic mistake. i
in your case is already an element from array
(i.e. another list), not an index of array
(not an int
), so
if Volume == i[2]: counter += 1
You can check the Python tutorial. Also, try doing this:
for i in array: print (i)
And see what you get!
Also I would advise to stick to naming conventions: variables are normally lower-case (volume
, not Volume
). In this case i
is misleading. row
or elem
would be much more suitable.
Related Posts:
- TypeError: list indices must be integers, not float
- Python – TypeError: ‘int’ object is not iterable
- Python – TypeError: ‘int’ object is not iterable
- What does the list() function do in Python?
- Relative imports in Python 3
- ModuleNotFoundError: No module named ‘requests’. But ‘requests’ already installed
- What are type hints in Python 3.5?
- ImportError: No module named ‘keras’
- TypeError: slice indices must be integers or None or have an __index__ method
- ImportError: libcublas.so.9.0: cannot open shared object file
- How to install xlrd in python3 library
- How to find all occurrences of an element in a list
- How to import cv2 in python3?
- ‘python3’ is not recognized as an internal or external command, operable program or batch file
- How to find all the indexes of a recurring item in a list?
- Unable to initialize device PRN in Python
- Error when executing `jupyter notebook` (No such file or directory)
- python3 is not recognized as an internal or external command, operable program or batch file showing for creating django runserver
- python3 : The term ‘python3’ is not recognized as the name of a cmdlet
- How can I solve ” module ‘pandas’ has no attribute ‘scatter_matrix’ ” error?
- Getting a map() to return a list in Python 3.x
- Install numpy on python3.3 – Install pip for python3
- How to import cv2 in python3?
- Why did ‘reset_index(drop=True)’ function unwantedly remove column?
- Python: create a pandas data frame from a list
- Python 3 – ValueError: not enough values to unpack (expected 3, got 2)
- How to return dictionary keys as a list in Python?
- python 3 – x for x for loops – how do they work?
- Visual Studio Python “Failed to launch the Python Process, please validate the path ‘python” & Error: spawn python ENOENT
- WinError 10061 – No Connection Could be made
- Python cant convert ‘list’ object to str error [closed]
- how do I upgrade pip on Mac?
- SyntaxError: unexpected EOF while parsing
- How can I reverse a list in Python?
- Difference between del, remove, and pop on lists
- How can I reverse a list in Python?
- How to use filter, map, and reduce in Python 3
- converting time from UTC to CST
- 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
- What is the difference between Python’s list methods append and extend?
- How can I make a time delay in Python? [duplicate]
- Understanding slice notation
- Understanding the main method of python [duplicate]
- Understanding slice notation
- TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array
- How to open a file using the open with statement
- TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array
- Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)
- TypeError: list indices must be integers or slices, not str
- How to install pip with Python 3?
- What is the difference between rw+ and r+
- Convert bytes to a string
- IndexError: list index out of range and python
- How can I represent an ‘Enum’ in Python?
- Import Error: No module named numpy
- Python3 – ModuleNotFoundError: No module named ‘numpy’
- Relative imports – ModuleNotFoundError: No module named x
- Python: ‘ModuleNotFoundError’ when trying to import module from imported package
- Relative imports – ModuleNotFoundError: No module named x
- How to convert list to string [duplicate]
- 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
- How do I get the number of elements in a list?
- How do I upgrade the Python installation in Windows 10?
- Difference between del, remove, and pop on lists
- How to overcome TypeError: unhashable type: ‘list’
- not all arguments converted during string formatting.. NO % variables
- How to avoid “ConcurrentModificationException” while removing elements from `ArrayList` while iterating it? [duplicate]
- How do I use raw_input in Python 3
- Python Variable Declaration
- Relative imports in Python 3
- Relative imports in Python 3
- Finding the index of an item in a list
- Difference between Arrays.asList(array) and new ArrayList
(Arrays.asList(array)) - Finding the index of an item in a list
- Accessing the index in ‘for’ loops?
- working of \n in python [duplicate]
- Pip freeze vs. pip list
- How to make a flat list out of a list of lists
- Convert list to array in Java [duplicate]
- Removing duplicates in lists
- Accessing the index in ‘for’ loops?
- Best way to convert string to bytes in Python 3?
- Best way to convert string to bytes in Python 3?
- TypeError: not all arguments converted during string formatting python
- List changes unexpectedly after assignment. Why is this and how can I prevent it?
- Why does this iterative list-growing code give IndexError: list assignment index out of range?
- PermissionError: [Errno 13] Permission denied
- What is setup.py?
- How is Anaconda related to Python?
- PermissionError: [Errno 13] in Python
- FileNotFoundError: [WinError 2] The system cannot find the file specified:
- Converting array to list in Java
- TypeError: ‘float’ object is not subscriptable
- Is there a short contains function for lists?
- Invalid character in identifier
- How to get the list of all installed color schemes in Vim?
- Should I put #! (shebang) in Python scripts, and what form should it take?
- TypeError: ‘float’ object is not subscriptable