Skip to content

Data

API Description
list_datasets List available scikit-mobility datasets.
load_dataset Load one of the original scikit-mobility datasets.
get_dataset_info Return metadata for a dataset.

Datasets

Name Type Description
foursquare_nyc trajectory Foursquare checkins of individuals in New York City.
flow_foursquare_nyc flow Movements between 4 km tiles in NYC derived from Foursquare data.
taxi_san_francisco trajectory GPS traces of ~500 taxis over 30 days in the San Francisco Bay Area. Requires auth.
parking_san_francisco auxiliar Parking meters in San Francisco.
nyc_boundaries shape NYC Borough Boundaries shapefile (water areas included).

API Reference

fastmob.data.list_datasets(details=False, data_types=None)

List datasets.

List all the names of the datasets available in the data module of scikit-mobility.

Parameters:

Name Type Description Default
details bool

Whether to return full metadata for each dataset instead of the name only. The default is False.

False
data_types str or list of str

Specify which dataset types to show. Accepted values: "trajectory", "flow", "shape", "auxiliar". The default is None (all types).

None

Returns:

Type Description
list of str or dict

A list of dataset names, or a dict mapping name to metadata when details=True.

Examples:

>>> from fastmob.data import list_datasets
>>> list_datasets()
['flow_foursquare_nyc', 'foursquare_nyc', 'nyc_boundaries', 'parking_san_francisco', 'taxi_san_francisco']

fastmob.data.load_dataset(name, drop_columns=False, auth=None, show_progress=False)

Load dataset.

Load one of the datasets that are present in the repository of scikit-mobility.

Parameters:

Name Type Description Default
name str

The name of the dataset to load (e.g., foursquare_nyc).

required
drop_columns bool

Whether to keep additional columns when returning a TrajDataFrame. The default is False.

False
auth tuple of str

Pair of strings (user, password) used when the dataset requires authentication. The default is None.

None
show_progress bool

If True, show a progress bar during download. The default is False.

False

Returns:

Type Description
TrajDataFrame or FlowDataFrame or GeoDataFrame or DataFrame

An object containing the downloaded dataset.

Examples:

>>> from fastmob.data import load_dataset, list_datasets
>>> tdf_nyc = load_dataset("foursquare_nyc", drop_columns=True)
>>> print(tdf_nyc.head())
   uid        lat        lng                  datetime
0  470  40.719810 -74.002581 2012-04-03 18:00:09+00:00
1  979  40.606800 -74.044170 2012-04-03 18:00:25+00:00
2   69  40.716162 -73.883070 2012-04-03 18:02:24+00:00
3  395  40.745164 -73.982519 2012-04-03 18:02:41+00:00
4   87  40.740104 -73.989658 2012-04-03 18:03:00+00:00

fastmob.data.get_dataset_info(name)

Get dataset info.

Return the metadata stored in the JSON file associated with the dataset.

Parameters:

Name Type Description Default
name str

The name of the dataset to query (e.g., foursquare_nyc).

required

Returns:

Type Description
dict

A dictionary containing the dataset metadata.

Examples:

>>> from fastmob.data import get_dataset_info
>>> get_dataset_info("foursquare_nyc")
{'name': 'Foursquare_NYC',
 'description': 'Dataset containing the Foursquare checkins of individuals moving in New York City',
 'url': 'http://www-public.it-sudparis.eu/~zhang_da/pub/dataset_tsmc2014.zip',
 'hash': 'cbe3fdab373d24b09b5fc53509c8958c77ff72b6c1a68589ce337d4f9a80235b',
 'auth': 'no',
 'data_type': 'trajectory',
 'download_format': 'zip',
 'sep': '\t',
 'encoding': 'ISO-8859-1'}