(For working in IPython only, either terminal or QTConsole, not Notebook) Is there a way to make a regular print statement (yes, 2.7) automatically print the head and tail (or even just the head) of a variable if it is over some arbitrary size?
If I print dataframe on a pandas dataframe that is too big, pandas automatically just prints the head. I'd like it work that way on lists and numpy arrays too, so that the next time I accidentally print a giant array out by accident I don't wind up with 100 pages of numbers. (I'm sure I could write a function to do this, but I reflexively use print, so I'm wondering if there's a way to control how much IPython will display - really, I'd rather change what the console displays instead of what the program is doing.)


View Solution