google/temporian

Sorting of `to_numpy` and `to_pandas`

Opened this issue · 0 comments

These functions are not enforcing a specific sorting as discussed in #378.

Sorting by timestamp makes the most sense (IMO) but there is a case for sorting by index and then timestamp.

In [6]: evset = tp.event_set(
   ...:     timestamps=['2023-11-08T17:14:38', '2023-11-29T21:44:46'],
   ...:     features={
   ...:         "my_index": [1, 0],
   ...:     },
   ...:     indexes=["my_index"],
   ...: )
   ...: tp.to_pandas(evset)
Out[6]:
   my_index           timestamp
0         0 2023-11-29 21:44:46
1         1 2023-11-08 17:14:38

In [7]: evset = tp.event_set(
   ...:     timestamps=['2023-11-08T17:14:38', '2023-11-29T21:44:46'],
   ...:     features={
   ...:         "my_index": [0, 1],
   ...:     },
   ...:     indexes=["my_index"],
   ...: )
   ...: tp.to_pandas(evset)
Out[7]:
   my_index           timestamp
0         1 2023-11-29 21:44:46
1         0 2023-11-08 17:14:38