🌐
Data Science Dojo
datasciencedojo.com › home › blog › programming › the mystery of indexing: a guide to index types in python
The Mystery of Indexing: A Guide to Index Types in Python
Use Vectorized Indexing with NumPy and Pandas: Libraries like NumPy and pandas offer vectorized indexing, meaning that they can perform operations on entire datasets at once, without needing loops.
Published: January 23, 2026
🌐
Pandas
pandas.pydata.org › docs › user_guide › indexing.html
Indexing and selecting data — pandas 3.0.6 documentation
Object selection has had a number of user-requested additions in order to support more explicit location based indexing. pandas now supports three types of multi-axis indexing. .loc is primarily label based, but may also be used with a boolean array. .loc will raise KeyError when the items are not found. Allowed inputs are: A single label, e.g. 5 or 'a' (Note that 5 is interpreted as a label of the index. This use is not an integer position along the index.). A list or array of labels ['a', 'b', 'c']. A slice object with labels 'a':'f' (Note that contrary to usual Python slices, both the start and the stop are included, when present in the index!
Discussions

What does index mean in python? - Stack Overflow
So the index of letter e in "Hello" is 1. ... It should return you 1. You can further play with it an run it again what it does. Try to replace "e" with "H", next try something that isn't in "Hello". ... Save this answer. ... Show activity on this post. If a street with houses is an analogy for an array with elements, then house number is analogy for index. However, Python uses numbers from zero. The built in sequence types ... More on stackoverflow.com
🌐 stackoverflow.com
Curious how Python list indexing works
From what I understand about arrays, the general process to index into an array is that there is a pointer that points to the base address of the array and consequently, the desired element can be retrieved by multiplying the element index by the size of the single element. That's how C works. However, lists are data structures built into Python that also offer the same ability to index but also allow for different element types. Here we're getting into internals of the interpreter, which can differ from one interpreter to another. The CPython interpreter is written in C, so it likely uses arrays of pointers, or arrays of some sort of struct with a pointer pointing to the actual data. Pointers are the same size regardless of what they're pointing to. Jython is an interpreter written in Java, so I would guess that uses a type that is a base class for an object instance. More on reddit.com
🌐 r/learnprogramming
6
3
May 18, 2023
Embarrassingly, i don't understand how list indexing works
Let us step back a little. Before understanding your example, try to grok the example below for i in range(0, 3): print(i) which results in: 0 1 2 And the example below my_list = [42, 6, 2024] for i in range(0, 3): print(i, my_list[i]) Which results in: 0 42 1 6 2 2024 Are those clear to ya? Thanks! More on reddit.com
🌐 r/learnpython
26
15
August 31, 2024
So confused about indexing
Or if you wonder why you would write 4 to get first four characters, line in "programming"[:4], it's because the stop index is not included in the slice. So to get slice of items #0 to 3, you specify 3 + 1, which is 4. More on reddit.com
🌐 r/learnpython
12
0
August 21, 2022
🌐
Medium
medium.com › @bhagat_16083 › a-guide-to-different-types-of-indexes-in-python-dd1425e2d7c0
A guide to different types of indexes in Python | by Bhagat | Medium
May 10, 2023 - The index starts from 0 and increases by one for each item from left to right or top to bottom. When discussing indexes for Python data structure specifically, there are two common types: sequence indexing and dictionary indexing.
🌐
W3Schools
w3schools.com › python › ref_list_index.asp
Python List index() Method
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Training ... The index() method returns the position at the first occurrence of the specified value.
🌐
AskPython
askpython.com › python › list › indexing-in-python
Indexing in Python - A Complete Beginners Guide - AskPython
April 4, 2023 - This tutorial will explain everything ... indexing in Python. But first, let’s take a quick look at iterables. Before we get started with indexing, let’s understand what iterables are and what is their main function. The knowledge of iterables is much needed to go behind indexing. Iterables are a special type of objects ...
🌐
Railsware
railsware.com › home › engineering › indexing and slicing for lists, tuples, strings, other sequential types in python
Python Indexing and Slicing for Lists, Tuples, Strings, other Sequential Types | Railsware Blog
January 22, 2025 - Python supports slice notation for any sequential data type like lists, strings, tuples, bytes, bytearrays, and ranges. Also, any new data structure can add its support as well. This is greatly used (and abused) in NumPy and Pandas libraries, which are so popular in Machine Learning and Data Science. It’s a good example of “learn once, use everywhere”. In this article, we will focus on indexing and slicing operations over Python’s lists.
🌐
Pythonforall
pythonforall.com › python › DataTypes › dt_indexing
Python Data Types | PythonForAll
May 24, 2026 - The most popular sequence types are strings, lists, and tuples. To work effectively with these collections, you need to know how to grab specific elements out of them. We do this through two essential techniques: Indexing: Accessing a single specific item at a known position. Slicing: Accessing a range or subsection of items. Let us learn exactly how these systems work in Python!
🌐
HackerEarth
hackerearth.com › practice › notes › samarthbhargav › a-quick-intro-to-indexing-in-python
A Quick intro to Indexing in Python - Samarth Bhargav
Slicing a list gives us another list, instead of a single element. Slicing is an incredibly useful feature in python, one that you will use a lot! A slice specifies a start index and an end index, and creates and returns a new list based on the indices. The indices are separated by a colon ':'. Keep in mind that the sub-list returned contains only the elements till (end index - 1).
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-list-index
Python List index() - Find Index of Item - GeeksforGeeks
Data Types · Interview Questions · Examples · Quizzes · DSA Python · Data Science · NumPy · Pandas · Practice · Django · Flask · Last Updated : 17 Jul, 2026 · index() method is used to find the position of an element in a list. It searches the list from left to right and returns the index of the first matching occurrence.
Published: July 17, 2026
🌐
DevGenius
blog.devgenius.io › indexing-vs-slicing-in-python-de01cd99c499
Indexing vs Slicing in Python. Get to know about indexing and slicing | by Indhumathy Chelliah | Dev Genius
January 25, 2021 - Indexing and Slicing can be be done in Python Sequences types like list, string, tuple, range objects. Indexing starts from 0.
🌐
freeCodeCamp
freecodecamp.org › news › slicing-and-indexing-in-python
Slicing and Indexing in Python – Explained with Examples
December 11, 2025 - Understanding how to use slicing and indexing is essential for working with data in Python, so let's explore these concepts in detail and provide real-life examples to help you understand how they work. Indexing is the process of accessing an element in a sequence using its position in the ...
🌐
All About AI-ML
indhumathychelliah.com › 2020 › 09 › 22 › indexing-vs-slicing-in-python
Indexing vs Slicing in Python – All About AI-ML
January 2, 2022 - Indexing and Slicing can be be done in Python Sequences types like list, string, tuple, range objects. Indexing starts from 0.
🌐
Mimo
mimo.org › glossary › python › index-element
Python Index: Efficient Data Retrieval and Navigation
Learn basics, data types, control flow, and more ... In this example, the list temperatures contains four elements. Using temperatures[1] returns the second value, which is 20, because Python indexing starts from 0. Python also supports negative indices. A negative index counts from the end of the ...
🌐
Quansight-labs
quansight-labs.github.io › ndindex › indexing-guide › index.html
Guide to NumPy Indexing - ndindex documentation
This section is itself split into six subsections. First is a basic introduction to what a NumPy array is. Following this are pages for each of the remaining index types, the basic indices: tuples, ellipses, and newaxis; and the advanced indices: integer arrays and boolean arrays (i.e., masks).
🌐
Medium
medium.com › @shilpasree209 › indexing-slicing-in-python-f45d9caed433
Indexing & Slicing in Python!!!. These 2 things are interesting terms… | by Shilpa Sreekumar | Medium
January 23, 2024 - As seen in the example above, you can notice that there are 3 key concepts in indexing: Zero-based indexing : Python starts counting indices from 0, not 1. So, the first element has an index of 0, the second has an index of 1, and so on.
🌐
Real Python
realpython.com › lessons › indexing-and-slicing
Indexing and Slicing (Video) – Real Python
In this video, you’ll practice list indexing and slicing. The elements of a list can be accessed by an index. To do that, you name the list, and then inside of a pair of square brackets you use an index number, like what I’m showing right here. That…
Published: September 3, 2019
🌐
Real Python
realpython.com › ref › glossary › indexing
indexing | Python Glossary – Real Python
In Python, indexing is an operation that allows you to access individual items within a sequence, such as a list, tuple, or string, using integer indices and the syntax sequence[index]. Python uses zero-based indexing, meaning that the first ...
🌐
Reddit
reddit.com › r/learnprogramming › curious how python list indexing works
r/learnprogramming on Reddit: Curious how Python list indexing works
May 18, 2023 -

Sorry if this question has an easy answer - I couldn't find one, but I might be using the wrong search terms.

From what I understand about arrays, the general process to index into an array is that there is a pointer that points to the base address of the array and consequently, the desired element can be retrieved by multiplying the element index by the size of the single element.

However, lists are data structures built into Python that also offer the same ability to index but also allow for different element types. So how does indexing work when the size of elements is not constant?

This also led me to believe that Python list are linked list, but searching that up revealed a couple of articles showing how to implement linked list into Python as they are not within the standard library:

https://www.geeksforgeeks.org/python-library-for-linked-list/

https://www.tutorialspoint.com/python_data_structure/python_linked_lists.htm

Top answer
1 of 3
4
From what I understand about arrays, the general process to index into an array is that there is a pointer that points to the base address of the array and consequently, the desired element can be retrieved by multiplying the element index by the size of the single element. That's how C works. However, lists are data structures built into Python that also offer the same ability to index but also allow for different element types. Here we're getting into internals of the interpreter, which can differ from one interpreter to another. The CPython interpreter is written in C, so it likely uses arrays of pointers, or arrays of some sort of struct with a pointer pointing to the actual data. Pointers are the same size regardless of what they're pointing to. Jython is an interpreter written in Java, so I would guess that uses a type that is a base class for an object instance.
2 of 3
3
It looks like CPython (the default implementation and the one you're probably using) uses dynamic arrays. https://github.com/python/cpython/blob/5c22476c01622f11b7745ee693f8b296a9d6a761/Include/listobject.h#L22 If you try to insert into an index in a list that does not yet exist, a new buffer will be allocated and all the existing values will be copied over. https://github.com/python/cpython/blob/1ca315538f2f9da6c7b86c4c46e76d454c1ec4b9/Objects/listobject.c#L290 And, as one of the other posters pointed out, these arrays are typically storing pointers for the values, which is how it deals with values of different types.
🌐
Couchbase Developer Portal
developer.couchbase.com › tutorial-python-indexing
Tutorial - Indexing with Python | Couchbase Developer Portal
In this tutorial, you will learn about the six types of indexes that you can create using the Index Service as well as how they help to query for data efficiently and improve query performance.