I love using the .head() and .tail() functions in pandas to circumstantially display a certain amount of rows (sometimes I want less, sometimes I want more!). But is there a way to do this with the columns of a DataFrame?
Yes, I know that I can change the display options, as in:
pd.set_option('display.max_columns', 20)
But that is too clunky to keep having to change on-the-fly, and anyway, it would only replace the .head() functionality, but not the .tail() functionality.
I also know that this could be done using an accessor:
yourDF.iloc[:,:20] to emulate .head(20) and yourDF.iloc[:,-20:] to emulate .tail(20).
It may look like a short amount of code, but honestly it's not as intuitive nor swift as when I use .head().
Does such a command exist? I couldn't find one!