1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Plotting each row in a pandas DataFrame as a bar with seaborn

Discussão em 'Python' iniciado por Stack, Setembro 12, 2024.

  1. Stack

    Stack Membro Participativo

    Given such a dataframe,

    data = pd.DataFrame({'a':[1,2],'b':[2,3],'c':[3,4],'d':[1,2],'code':[1,2]})

    a b c d code
    0 1 2 3 1 1
    1 2 3 4 2 2


    I want to have a barplot with a 2 bars for each column (one for each row...)

    this one

    sns.barplot(data.iloc[0])


    works just fine,

    [​IMG]

    but when i try to doit for 2 columns,

    sns.barplot(data,hue='code')


    claims:


    ValueError: The following variable cannot be assigned with wide-form data: hue

    Continue reading...

Compartilhe esta Página