Error in code in the section "Time to slice and dice", course "NLP Course"

When we execute code

frequencies = (
    train_df["condition"]
    .value_counts()
    .to_frame()
    .reset_index()
    .rename(columns={"index": "condition", "condition": "frequency"})
)
frequencies.head()

answer should be like this

condition | frequency
birth control | 27655
depression | 8023
acne | 5209
anxiety | 4991
pain | 4744

but he is different (wrong)

frequency | count
birth control | 27655
depression | 8023
acne | 5209
anxiety | 4991
pain | 4744

this is not correct, correct code

frequencies = (
    train_df["condition"]
    .value_counts()
    .to_frame()
    .reset_index()
    .rename(columns={"index": "condition", "count": "frequency"})
)
1 Like

Maybe here.