Does a single-indexed DataFrame use hash-based indexing?
ans No, Pandas does not use hash-based indexing for single-indexed DataFrames. Instead, it relies on array-based lookups or binary search when the index is sorted. If the index is unsorted, Pandas performs a linear scan, which is less efficient.
ans 2 :
If the DataFrame is sorted using sort_index(), Pandas can leverage a binary search to achieve faster lookups. Without sorting, lookups default to a linear scan.
ans 3: Hash-based indexing is more challenging for multi-indexes due to the hierarchical nature of the index. Instead, Pandas relies on binary search (for sorted indexes) or linear scan (for unsorted indexes) because these methods handle hierarchical indexing efficiently. Hash-based indexing would introduce additional overhead and complexity when working with multiple levels.