0

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.

1 Answer 1

1

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
1
  • Sure, I will do!
    – Ramsey A.
    Oct 9, 2022 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.