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
- TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array
- How to install pip with Python 3?
- Import Error: No module named numpy
- Python3 – ModuleNotFoundError: No module named ‘numpy’
- TypeError: a bytes-like object is required, not ‘str’ when writing to a file in Python3
- WinError 2 The system cannot find the file specified (Python)
- hashlib.md5() TypeError: Unicode-objects must be encoded before hashing
- Could not find a version that satisfies the requirement tensorflow
- AttributeError: ‘module’ object has no attribute ‘urlopen’
- How to upgrade pip3?
- SystemError: Parent module ” not loaded, cannot perform relative import
- TypeError: ‘<=' not supported between instances of 'str' and 'int' [duplicate]
- Remove list from list in Python
- TypeError: unsupported operand type(s) for -: ‘str’ and ‘int’
- How to Read .txt in Pandas
- Pinging servers in Python
- Add Legend to Seaborn point plot
- How to pass arguments to a Button command in Tkinter?
- How to remove specific substrings from a set of strings in Python?
- Python: Array v. List
- enumerate() for dictionary in python
- What is a list in Bash?
- Alphabet range in Python
- How to check if a string is a substring of items in a list of strings?
- Pop index out of range
- UnicodeDecodeError: ‘charmap’ codec can’t decode byte X in position Y: character maps to
- Print list without brackets in a single row
- How to initialize a list of strings (List
) with many string values - What is the meaning of ‘for _ in range()
- How do I check if there are duplicates in a flat list?
- How to easily initialize a list of Tuples?
- Converting from IEnumerable to List
- How to concatenate items in a list to a single string?
- HashSet vs. List performance
- ImportError: No module named ‘yaml’
- TypeError: ‘_io.TextIOWrapper’ object is not subscriptable
- How to print multiple lines of text with Python
- Python data structure sort list alphabetically
- How do I run pip on python for windows?
- How to create a numpy array of lists?
- python: can’t open file ‘manage.py’: [Errno 2] No such file or directory
- What does {0} mean in this Python string?
- Tab Error in Python
- Python 3.5.1 urllib has no attribute request
- XSLT equivalent for JSON
- What is the meaning of “int(a[::-1])” in Python?
- Why would cv2.COLOR_RGB2GRAY and cv2.COLOR_BGR2GRAY give different results?
- Determine if 2 lists have the same elements, regardless of order? [duplicate]
- Building a list inside a list in python
- Error loading MySQLdb module: No module named ‘MySQLdb’
- Editing a Post, 99% CPU?
- How to find the number of Tags a post has?
- wordpress wp_list_categories
- Adding (blog-specific) links to “My Sites” admin page
- WooCommerce Grid / List view
- custom walker wp menu last element
- Display the last post by each category?
- List all categories with featured image from post?
- Authors list Pagination : result set from $wpdb->get_results()
- Is a list page usually called an archive page in WordPress?
- Hide specific category from wp_list_categories
- display widget checkbox selection on frontend
- Highlighting Current Category in the Archive and Feeds page
- How to let users create lists of woocommerce products?
- Wrap Meta Box with and for each new line
- How to Create a Frontend Html-list Editable in the Backend?
- How to make a text string into a bullet list [closed]