Input/Output
| API | Description |
|---|---|
load_geolife_trajectories |
Load Microsoft GeoLife .plt trajectory files into a TrajDataFrame. |
read |
Read a trajectory table from disk and return a TrajDataFrame. |
write |
Write a trajectory dataframe to disk. |
fastmob.io.file.load_geolife_trajectories(path, user_ids=None, **kwargs)
Load Microsoft GeoLife .plt trajectory files into a TrajDataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
local path of the directory 'Geolife Trajectories 1.3/' |
required |
user_ids
|
list
|
list of user IDs to load. If empty or None, all users are loaded. |
None
|
**kwargs
|
dict
|
Additional keyword arguments passed to the |
{}
|
Returns:
| Type | Description |
|---|---|
TrajDataFrame
|
a TrajDataFrame with |
fastmob.io.file.read(filename, **kwargs)
Read a trajectory table from disk and return a TrajDataFrame.
CSV and delimited text files are read with pyarrow.csv.read_csv; parquet
files are read with pyarrow.parquet.read_table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
path and name of the file to read. |
required |
**kwargs
|
dict
|
For parquet files, passed to |
{}
|
Returns:
| Type | Description |
|---|---|
TrajDataFrame
|
object loaded from file. |
fastmob.io.file.write(tdf, filename, **kwargs)
Write a trajectory dataframe to disk.
CSV and delimited text files are written with pyarrow.csv.write_csv;
parquet files are written with pyarrow.parquet.write_table. The input
is materialized as a pyarrow.Table via Narwhals first, so any
Narwhals-compatible backend (pandas, polars, pyarrow, ...) is accepted
regardless of tdf's own backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tdf
|
TrajDataFrame or DataFrame - like
|
TrajDataFrame object (or any Narwhals-compatible dataframe) that will be saved. |
required |
filename
|
str
|
path and name of the output file. |
required |
**kwargs
|
dict
|
For parquet files, passed to |
{}
|
Returns:
| Type | Description |
|---|---|
None
|
|