pandas show head and tail

Solutions on MaxInterview for pandas show head and tail by the best coders in the world

showing results for - "pandas show head and tail"
Simon
03 Feb 2017
1#make 100 3d random numbers
2df = pd.DataFrame(np.random.randn(100,3))
3
4# sort them by their axis sum
5df = df.loc[df.sum(axis=1).index]
6
7with pd.option_context('display.max_rows',10):
8    print(df)