pandas count all values in whole dataframe
df.stack().value_counts()
Here is what the above code is Doing:
1. We’re using the .stack() method to move the column names into the index.
2. We’re using the .value_counts() method to count the number of times each value appears.