Indexing

Engineering

R-Tree: Spatial Data Indexing

Traditional B-trees excel at one-dimensional data. Finding all users with IDs between 1000 and 2000 is straightforward—the data has a natural ordering. But what about finding all restaurants within 5…

Read more →
Python

NumPy - Ellipsis (...) in Indexing

The ellipsis (...) is a built-in Python singleton that NumPy repurposes for advanced array indexing. When you work with high-dimensional arrays, explicitly writing colons for each dimension becomes…

Read more →
Python

NumPy - Boolean/Mask Indexing

Boolean indexing in NumPy uses arrays of True/False values to select elements from another array. When you apply a conditional expression to a NumPy array, it returns a boolean array of the same…

Read more →
Python

How to Use Fancy Indexing in NumPy

NumPy’s basic slicing syntax (arr[1:5], arr[::2]) handles contiguous or regularly-spaced selections well. But real-world data analysis often requires grabbing arbitrary elements: specific rows…

Read more →