You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently in interactive mode, we evaluate Table, Column and Scalar expressions and display their results. For Table and Column values the repr is easily distinguishable from other python types. For scalar values it's not - they display the same as their in-memory counterparts. When working interactively (especially in a fast backend like duckdb) this can sometimes be confusing, as it makes it easy to forget that some object is an ibis scalar expression rather than its evaluated result.
In [1]: importibisIn [2]: t=ibis.memtable({"x": [1, 2, None], "y": [3, 4, 5]})
In [3]: ibis.options.interactive=TrueIn [4]: t# reprs in a unique enough way to know it's not a builtin typeOut[4]:
┏━━━━━━━━━┳━━━━━━━┓
┃ x ┃ y ┃
┡━━━━━━━━━╇━━━━━━━┩
│ float64 │ int64 │
├─────────┼───────┤
│ 1.0 │ 3 │
│ 2.0 │ 4 │
│ NULL │ 5 │
└─────────┴───────┘
In [5]: t.x# same hereOut[5]:
┏━━━━━━━━━┓
┃ x ┃
┡━━━━━━━━━┩
│ float64 │
├─────────┤
│ 1.0 │
│ 2.0 │
│ NULL │
└─────────┘
In [6]: t.x.sum() # reprs the same as a float. Is this a float, or an ibis expression? Hard to say from just looking at the repr.Out[6]: 3.0In [7]: ibis.literal(None) # same here - is this a None or an ibis object?Out[7]: None
This issue is partly to blame for confusion around #8833 - in this case the subexpression reprs as None, which led them to believe it would be treated the same as None if passed to a method to construct a larger expression. Better visually distinguishing these types would help here IMO.
I think it would be good to amend our interactive repr for scalars to better distinguish them still as ibis objects. I'm not sure what styling elements would be best to use here - perhaps just box it, the same as we do for columns or tables?
In [8]: t.x.sum()
Out[8]:
┌─────┐
│ 3.0 │
└─────┘
The text was updated successfully, but these errors were encountered:
Currently in interactive mode, we evaluate
Table
,Column
andScalar
expressions and display their results. ForTable
andColumn
values the repr is easily distinguishable from other python types. For scalar values it's not - they display the same as their in-memory counterparts. When working interactively (especially in a fast backend likeduckdb
) this can sometimes be confusing, as it makes it easy to forget that some object is an ibis scalar expression rather than its evaluated result.This issue is partly to blame for confusion around #8833 - in this case the subexpression reprs as
None
, which led them to believe it would be treated the same asNone
if passed to a method to construct a larger expression. Better visually distinguishing these types would help here IMO.I think it would be good to amend our interactive repr for scalars to better distinguish them still as ibis objects. I'm not sure what styling elements would be best to use here - perhaps just box it, the same as we do for columns or tables?
The text was updated successfully, but these errors were encountered: