File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1073,6 +1073,14 @@ def _concat_compat(to_concat, axis=0):
1073
1073
else :
1074
1074
return np .concatenate (to_concat , axis = axis )
1075
1075
1076
+ def in_interactive_session ():
1077
+ """ check if we're running in an interactive shell
1078
+
1079
+ returns True if running under python/ipython interactive shell
1080
+ """
1081
+ import __main__ as main
1082
+ return not hasattr (main , '__file__' )
1083
+
1076
1084
# Unicode consolidation
1077
1085
# ---------------------
1078
1086
#
Original file line number Diff line number Diff line change @@ -582,13 +582,15 @@ def _need_info_repr_(self):
582
582
else :
583
583
# save us
584
584
if (len (self .index ) > max_rows or
585
- len (self .columns ) > terminal_width // 2 ):
585
+ (com .in_interactive_session () and
586
+ len (self .columns ) > terminal_width // 2 )):
586
587
return True
587
588
else :
588
589
buf = StringIO ()
589
590
self .to_string (buf = buf )
590
591
value = buf .getvalue ()
591
- if max ([len (l ) for l in value .split ('\n ' )]) > terminal_width :
592
+ if (max ([len (l ) for l in value .split ('\n ' )]) > terminal_width and
593
+ com .in_interactive_session ()):
592
594
return True
593
595
else :
594
596
return False
You can’t perform that action at this time.
0 commit comments