Home > Net >  During wrangling my data I created the new table below. What do you call the first column? how can I
During wrangling my data I created the new table below. What do you call the first column? how can I

Time:10-09

What is that CustomerID called? is it index?

copy of the codes and output can be find here Sorry! Stack overflow is not allowing me to just copy and paste the picture here yet.

CodePudding user response:

It's called a hierarchical-index.

import pandas as pd


data = {
    "foo": [1, 2, 3],
    "spam": [4, 5, 6]
}
df = pd.DataFrame(data).set_index("foo")

uniques = len(df.index.unique("foo"))
print(uniques)

3
  • Related