Skip to content

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 TrajDataFrame constructor.

{}

Returns:

Type Description
TrajDataFrame

a TrajDataFrame containing all trajectories


fastmob.io.file.read(filename, **kwargs)

Read a trajectory table from disk and return a TrajDataFrame.

CSV and delimited text files are read with pandas.read_csv; parquet files are read with pandas.read_parquet.

Parameters:

Name Type Description Default
filename str

path and name of the file to read.

required
**kwargs dict

Additional keyword arguments passed to pandas.read_csv or pandas.read_parquet.

{}

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 DataFrame.to_csv; parquet files are written with DataFrame.to_parquet.

Parameters:

Name Type Description Default
tdf TrajDataFrame or DataFrame

TrajDataFrame object that will be saved.

required
filename str

path and name of the output file.

required
**kwargs dict

Additional keyword arguments passed to DataFrame.to_csv or DataFrame.to_parquet.

{}

Returns:

Type Description
None