trajdl.datasets.arrow.locseq module#

class trajdl.datasets.arrow.locseq.LocSeqDataset(table: Table, unsafe: bool = False)[source]#

Bases: BaseArrowDataset

Dataset for location sequences.

check_table(table: Table) None[source]#

Validate the input Arrow table.

Parameters:

table (pa.Table) – The Arrow table to validate.

Notes

This method is a placeholder and needs to be implemented to ensure the table complies with expected structure and data types.

classmethod init_from_loc_seqs(seqs: Iterable[LocSeq]) LocSeqDataset[source]#

Initialize the dataset from an iterable of location sequences.

Parameters:

seqs (Iterable[LocSeq]) – An iterable containing LocSeq objects.

Returns:

An instance of LocSeqDataset initialized from the provided location sequences.

Return type:

LocSeqDataset

Notes

The method extracts the ‘data’, ‘id’, and ‘ts’ attributes from each LocSeq object to build an Arrow table.

classmethod schema() Schema[source]#

Get the Arrow schema for the location sequence dataset.

Returns:

The schema definition for the dataset, defined in LOC_SEQ_ARROW_SCHEMA.

Return type:

pa.lib.Schema

sub_classes_construction(*args, **kwargs) LocSeq[source]#

这个方法是将table的一行数据转换为单条序列的实例