deephaven / deephaven-docs-community

Source code for Community docs on the deephaven.io website.
Apache License 2.0
0 stars 5 forks source link

Community Question: Create columns in Python that can be unrolled #128

Closed margaretkennedy closed 7 months ago

margaretkennedy commented 8 months ago

For the Community Questions page

A client sent this to us:

I expect this to work, but it gives an error that ‘offsets’ is not an Array column: image

My response:

The offsets need to be converted to a java array for the ungroup to work.  As of right now, the python list is not recognized as an ungroupable type, since it is seen as a generic python object.

from deephaven import empty_table
from deephaven import dtypes

offsets = [1,2,3,4]
offsets = dtypes.array(dtypes.int64, offsets)

t1 = empty_table(10).update("X = i")
t2 = t1.update("Offsets=offsets")
t3 = t2.ungroup()
t4 = t2.ungroup("Offsets")
margaretkennedy commented 7 months ago

Resolved by https://github.com/deephaven/deephaven.io/pull/3617