PerformanceWarning: indexing past lexsort depth may impact performance. code example

Example: ipykernel_launcher.py:3: PerformanceWarning: indexing past lexsort depth may impact performance. This is separate from the ipykernel package so we can avoid doing imports until

arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],
         ['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]


tuples = list(zip(*arrays))

tuples

index = pd.MultiIndex.from_tuples(tuples, names=['first', 'second'])

index


s = pd.Series(np.random.randn(8), index=index)

s