I want to calculate the number of distinct values for all columns in a DataFrame.
Say, I have a DataFrame like this:
x y z
-----
0 0 0
0 1 1
0 1 2
And I want another DataFrame (or any other structure) of format:
col | num
---------
'x' | 1
'y' | 2
'z' | 3
What would be the most efficient way of doing that?