[Python] how to list out the unique values in a categorical column

Discussão em 'Python' iniciado por Stack, Fevereiro 13, 2025.

  1. Stack

    Stack Membro Participativo

    i want to list out the unique values in a categorical column. i already got the number of the unique values present. i now want it listed out without having to go through my column.

    i tried the df.nunique() and it gave me the number but i want it to list out the different unique values for instances i have in the categorical column

    channel used Column B
    youtube men 25-30
    facebook men 30-35
    instagram women 35-40
    youtube men 40-45
    email women 26_30

    df.nunique gives me the number of unique values in the channel used but i want it listed too such as ouput: youtube facebook instagram email

    Continue reading...

Compartilhe esta Página