Created
October 5, 2017 20:46
-
-
Save roycoding/bbecda07b594870a878f2f71f9fb15a8 to your computer and use it in GitHub Desktop.
Revisions
-
roycoding created this gist
Oct 5, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ def sandwich(df, rows=3): ''' Display n rows of head and tail of dataframe. Input: df - dataframe of interest rows - integer number of rows from each end of dataframe to display Output: dataframe ''' fill_row = pd.DataFrame(np.array(['...']*df.shape[1]).reshape(1, -1), columns=df.columns, index=['...']) return pd.concat([df.head(rows), fill_row, df.tail(rows)])