I've been wanting to make the following work so as to have a simple story for executing pandas.DataFrame.someColumnName.unique() function on each column within a pandas.DataFrame.
df.apply(func=unique, axis=0) # error NameError: name 'unique' is not defined
Is there some trick i'm overlooking to get this working or an alternative solution given the following to do something similar but using type() function on each column in pandas.DataFrame works.
df.apply(func=lambda x: type(x[0]), axis=0)
Note that i have been able to make the following work but doesn't seem to be a way in python to make single line for loops and i find the apply statement a better self documenting implementation.
for col in df.columns:
df[col].unique()