sort index value counts by column pandas code example Example 1: value count in python col-name.value_count() Example 2: frequency unique pandas df.stack().value_counts()