2

I am printing a python datatable Frame. It pages when I do that, it's waiting for my input at the end, even for very small Frames. For example,

In [12]: DT = dt.Frame(A=range(5))

In [13]: DT
      A
---  --
 0    0
 1    1
 2    2
 3    3
 4    4

[5 rows x 1 column]
Press q to quit  ↑←↓→ to move  wasd to page  t to toggle types  g to jump

As you can see there is no need to navigate the Frame here. Is there a way to stop doing this for all python datatable Frames?

Thanks!

Pasha
  • 6,298
  • 2
  • 22
  • 34
  • It would seem that you're not printing the frame here. does `print(DT)` give you the same prompt? – David Zemens Apr 09 '19 at 21:08
  • print(DT) simply shows the following: `` – user1426598 Apr 10 '19 at 13:55
  • OK yes, but my point is that you're not actually *printing* the data frame. You're just querying the IDE by evaluating the statement: `DT` which is returning the `DT.__repr__`. You could use the `DT.to_dict` or `DT.to_list` methods (though this won't display a *tabular* view. – David Zemens Apr 10 '19 at 15:41
  • Worth noting, as of yesterday night, they've made some change so that `str(DT)` should result in a preview: http://github.com/h2oai/datatable/pull/1788 – David Zemens Apr 10 '19 at 15:42

2 Answers2

2

As of 4/10/19, the latest version in github turns off the interactivity by default. Before 0.9.0 release we'd have to compile it from source to get it.

0

In the current dev version, and in future datatable 0.9+ the display will be non-interactive by default. This behavior can be controlled via option dt.options.display.interactive = True|False.

In datatable 0.8 and younger, there are 2 ways to prevent the interactive prompt when displaying a Frame:

  • either using Frame.view(False):

    In [1]: import datatable as dt                                                                                                                                                       
    
    In [2]: DT = dt.Frame(A=range(5))                                                                                                                                                    
    
    In [3]: DT.view(False)
          A
    ---  --
     0    0
     1    1
     2    2
     3    3
     4    4
    
    [5 rows x 1 column]
    
    In [4]:      
    
  • or change the default behavior via

    In [4]: dt.Frame.view.__defaults__ = (False,)
    
    In [5]: DT 
          A
    ---  --
     0    0
     1    1
     2    2
     3    3
     4    4
    
    [5 rows x 1 column]
    
Pasha
  • 6,298
  • 2
  • 22
  • 34