Skip to content

Proportions #199

@oldoc63

Description

@oldoc63
  • We can use the .value_counts() function to get a table of frequencies for a categorical variable.
  • However, it is sometimes more useful to instead look at the proportion of values in each category.
  • We can calculate proportions by dividing the frequency by the number of observations in the data:
df['education'].value_counts()/len(df['education'])
  • We can also calculate proportions using .value_counts() by setting the normalize parameter equal to True:
df['education'].value_counts(normalize = True).head()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions