[Python] How do I create a simple yes-no countplot (Pandas)?

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

  1. Stack

    Stack Membro Participativo

    I am trying to create a simple countplot giving a count for a yes-no statistics. However what do I get is y axis between 0 and 1 and not giving an actual count of the variable (re-scalling the axis did not work). Then the count is listed on the x axis. I just don't know how to fix this simple issue:-D Please help me >.>

    dict = {"Condition": ['no','yes'], "Smoking":[1561,635]}
    frame=pd.DataFrame(data=dict)
    frame.set_index("Condition", inplace=True)
    frame

    plt.figure(figsize=(8,6))
    sns.set_palette("pastel", 8)

    sns.countplot(data=frame, x="Smoking" )

    plt.show()

    Continue reading...

Compartilhe esta Página