skrub.DataOp.skb.preview#
- DataOp.skb.preview()[source]#
Get the value computed for previews (shown when printing the DataOp).
- Returns:
- preview result
The result of evaluating the DataOp on the data stored in its variables.
See also
DataOp.skb.subsample
Specify how to subsample an intermediate result when computing previews.
DataOp.skb.eval
Evaluate the DataOp. Unlike
preview
, we can pass new data rather than using the values that variables were initialized with, but results are not cached, and no subsampling takes place by default.
Examples
>>> import skrub
>>> a = skrub.var('a', 1) >>> b = skrub.var('b', 2) >>> c = a + b
When we display a DataOp, we see a preview of the result (
3
in this case):>>> c <BinOp: add> Result: ――――――― 3
If we want to actually access that value
3
, rather than just seeing it displayed, we can use.skb.preview()
:>>> c.skb.preview() 3
This is the actual number
3
, not a DataOp or just a display>>> type(c.skb.preview()) <class 'int'>
Accessing the preview is usually faster than calling
.skb.eval()
because results are cached and subsampling is used by default.