I am having a DataFrame (28 rows from the Titanic passenger list) which has a column "Sex" consisting of two values, "Male", "Female". I want to get the count of Males/Females
The output should show "Sex" as Row labels(index) and the count (of Male/Female) in the second column
df.pivot_table(index ="Sex", values ="Sex", aggfunc='count')
This returns a "ValueError: Grouper for 'Sex' not 1-dimensional" error.
Please guide