import pandas as pd # create a dataframe with one column df = pd.DataFrame({"col1": ["a", "b", "a", "c", "a", "a", "a", "c"]}) # setting normalize=True item_counts = df["col1"].value_counts(normalize=True) print(item_counts)
import pandas as pd # create a dataframe with one column df = pd.DataFrame({"col1": ["a", "b", "a", "c", "a", "a", "a", "c"]}) # setting normalize=True item_counts = df["col1"].value_counts(normalize=True) print(item_counts)