Q:

Pandas sort each row and print the top 5

I am trying to sort 25 columns individually and then print out the top 5 rows from each column. I assume that I will need to use a loop for this, but can't seem to figure it out.
I currently have:
df.sort_values(by=['A'], ascending=False)
 df.head()
df.sort_values(by=['B'], ascending=False)
 df.head()
df.sort_values(by=['C'], ascending=False)
 df.head() ...
The goal is to repeat this over many columns without having 25 lines of code. 

A:

If you rather want to print out each column separately, this should work
df.apply(lambda x: print(x.sort_values(ascending=False).head(5)), axis=0)

