import pandas as pd
import numpy as np

# create a sample dataframe
df = pd.DataFrame({'col1': ['a', 'b', 'c', 'a', 'b', 'a'],
                   'col2': ['x', 'y', 'z', 'x', 'y', 'x']})

# get the frequency of unique values
unique, counts = np.unique(np.ravel(df), return_counts=True)
value_counts = dict(zip(unique, counts))

print(value_counts)