Repository: mie-lab/trackintel

Issue:
Enable different geometry names for ``read_*_csv`` functions. 
In the `read_*_csv` functions we can load geometries only if they have the column name "geom".
We dropped the requirement of a fixed geometry name some time ago, so we should allow a more flexible approach.
The simplest solution would be to introduce a new keyword "geom_col" to specify the geometry column.


Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/mie-lab/trackintel/pull/351?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab) Report
> Merging [#351](https://codecov.io/gh/mie-lab/trackintel/pull/351?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab) (b8b5b67) into [master](https://codecov.io/gh/mie-lab/trackintel/commit/8312b9125e10da4a7b26513b29c4f9386ff4bdc9?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab) (8312b91) will **decrease** coverage by `2.23%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/mie-lab/trackintel/pull/351/graphs/tree.svg?width=650&height=150&src=pr&token=ITDZEEE1MO&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab)](https://codecov.io/gh/mie-lab/trackintel/pull/351?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab)

```diff
@@            Coverage Diff             @@
##           master     #351      +/-   ##
==========================================
- Coverage   96.40%   94.17%   -2.24%     
==========================================
  Files          40       40              
  Lines        1922     1922              
  Branches      313      313              
==========================================
- Hits         1853     1810      -43     
- Misses         31       75      +44     
+ Partials       38       37       -1     
```


| [Impacted Files](https://codecov.io/gh/mie-lab/trackintel/pull/351?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab) | Coverage Δ | |
|---|---|---|
| [trackintel/io/file.py](https://codecov.io/gh/mie-lab/trackintel/pull/351/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab#diff-dHJhY2tpbnRlbC9pby9maWxlLnB5) | `95.36% <100.00%> (ø)` | |
| [trackintel/io/postgis.py](https://codecov.io/gh/mie-lab/trackintel/pull/351/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab#diff-dHJhY2tpbnRlbC9pby9wb3N0Z2lzLnB5) | `49.36% <0.00%> (-48.11%)` | :arrow_down: |
| [trackintel/model/locations.py](https://codecov.io/gh/mie-lab/trackintel/pull/351/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab#diff-dHJhY2tpbnRlbC9tb2RlbC9sb2NhdGlvbnMucHk=) | `96.87% <0.00%> (-3.13%)` | :arrow_down: |
| [trackintel/model/trips.py](https://codecov.io/gh/mie-lab/trackintel/pull/351/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab#diff-dHJhY2tpbnRlbC9tb2RlbC90cmlwcy5weQ==) | `97.22% <0.00%> (-2.78%)` | :arrow_down: |
| [trackintel/model/positionfixes.py](https://codecov.io/gh/mie-lab/trackintel/pull/351/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab#diff-dHJhY2tpbnRlbC9tb2RlbC9wb3NpdGlvbmZpeGVzLnB5) | `97.82% <0.00%> (-2.18%)` | :arrow_down: |
| [trackintel/model/staypoints.py](https://codecov.io/gh/mie-lab/trackintel/pull/351/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab#diff-dHJhY2tpbnRlbC9tb2RlbC9zdGF5cG9pbnRzLnB5) | `98.14% <0.00%> (-1.86%)` | :arrow_down: |
| [trackintel/model/triplegs.py](https://codecov.io/gh/mie-lab/trackintel/pull/351/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab#diff-dHJhY2tpbnRlbC9tb2RlbC90cmlwbGVncy5weQ==) | `98.27% <0.00%> (-1.73%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/mie-lab/trackintel/pull/351?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/mie-lab/trackintel/pull/351?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab). Last update [8312b91...b8b5b67](https://codecov.io/gh/mie-lab/trackintel/pull/351?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mie-lab).


Patch:
diff --git a/docs/modules/model.rst b/docs/modules/model.rst
index ce54943..139b2a1 100644
--- a/docs/modules/model.rst
+++ b/docs/modules/model.rst
@@ -6,7 +6,6 @@ assumed that data is already available in all these classes, instead, trackintel
 provides functionality to generate everything starting from the raw GPS positionfix data 
 (consisting of at least ``(user_id, tracked_at, longitude, latitude)`` tuples).
 
-* **users**: The users for which data is available.
 * **positionfixes**: Raw GPS data.
 * **staypoints**: Locations where a user spent a minimal time.
 * **triplegs**: Segments covered with one mode of transport.
@@ -57,12 +56,6 @@ Available Accessors
 
 The following accessors are available within *trackintel*.
 
-UsersAccessor
--------------
-
-.. autoclass:: trackintel.model.users.UsersAccessor
-	:members:
-
 PositionfixesAccessor
 ---------------------
 
@@ -114,27 +107,6 @@ in case you want to quickly set up a database. Also take a look at the `example
 
 .. highlight:: sql
 
-The **users** table contains information about individual users for which mobility data is available 
-(i.e., each ``user_id`` appearing in the tables below should have a corresponding user in the ``users``
-table)::
-
-    CREATE TABLE users (
-        -- Common to all tables.
-        id bigint NOT NULL,
-
-        -- Specific attributes.
-        -- The attributes contain additional information that might be given for each user. This
-        -- could be demographic information, such as age, gender, or income. 
-        attributes json,
-
-        -- Spatial attributes.
-        geom_home geometry(Point, 4326),
-        geom_work geometry(Point, 4326),
-
-        -- Constraints.
-        CONSTRAINT users_pkey PRIMARY KEY (id)
-    );
-
 The **positionfixes** table contains all positionfixes (i.e., all individual GPS trackpoints, 
 consisting of longitude, latitude and timestamp) of all users. They are not only linked to 
 a user, but also (potentially, if this link has already been made) to a tripleg or a staypoint::
diff --git a/sql/create_tables_pg.sql b/sql/create_tables_pg.sql
index 4e1ce7d..1da4756 100644
--- a/sql/create_tables_pg.sql
+++ b/sql/create_tables_pg.sql
@@ -3,23 +3,6 @@
 
 CREATE EXTENSION PostGIS;
 
-CREATE TABLE users (
-    -- Common to all tables.
-    id bigint NOT NULL,
-
-    -- Specific attributes.
-    -- The attributes contain additional information that might be given for each user. This
-    -- could be demographic information, such as age, gender, or income. 
-    attributes json,
-
-    -- Spatial attributes.
-    geom_home geometry(Point, 4326),
-    geom_work geometry(Point, 4326),
-
-    -- Constraints.
-    CONSTRAINT users_pkey PRIMARY KEY (id)
-);
-
 CREATE TABLE positionfixes (
     -- Common to all tables.
     id bigint NOT NULL,
diff --git a/trackintel/io/file.py b/trackintel/io/file.py
index 879b322..6443763 100644
--- a/trackintel/io/file.py
+++ b/trackintel/io/file.py
@@ -141,7 +141,7 @@ def write_positionfixes_csv(positionfixes, filename, *args, **kwargs):
     df.to_csv(filename, index=True, *args, **kwargs)
 
 
-def read_triplegs_csv(*args, columns=None, tz=None, index_col=object(), crs=None, **kwargs):
+def read_triplegs_csv(*args, columns=None, tz=None, index_col=object(), geom_col="geom", crs=None, **kwargs):
     """
     Read triplegs from csv file.
 
@@ -163,9 +163,12 @@ def read_triplegs_csv(*args, columns=None, tz=None, index_col=object(), crs=None
         pytz compatible timezone string. If None UTC is assumed.
 
     index_col : str, optional
-        column name to be used as index. If None the default index is assumed
+        Column name to be used as index. If None the default index is assumed
         as unique identifier.
 
+    geom_col : str, default "geom"
+        Name of the column containing the geometry as WKT.
+
     crs : pyproj.crs or str, optional
         Set coordinate reference system. The value can be anything accepted
         by pyproj.CRS.from_user_input(), such as an authority string
@@ -203,7 +206,7 @@ def read_triplegs_csv(*args, columns=None, tz=None, index_col=object(), crs=None
     df = df.rename(columns=columns)
 
     # construct geom column
-    df["geom"] = df["geom"].apply(wkt.loads)
+    df[geom_col] = df[geom_col].apply(wkt.loads)
 
     # transform to datatime
     df["started_at"] = pd.to_datetime(df["started_at"])
@@ -254,7 +257,7 @@ def write_triplegs_csv(triplegs, filename, *args, **kwargs):
     df.to_csv(filename, index=True, *args, **kwargs)
 
 
-def read_staypoints_csv(*args, columns=None, tz=None, index_col=object(), crs=None, **kwargs):
+def read_staypoints_csv(*args, columns=None, tz=None, index_col=object(), geom_col="geom", crs=None, **kwargs):
     """
     Read staypoints from csv file.
 
@@ -280,6 +283,9 @@ def read_staypoints_csv(*args, columns=None, tz=None, index_col=object(), crs=No
         column name to be used as index. If None the default index is assumed
         as unique identifier.
 
+    geom_col : str, default "geom"
+        Name of the column containing the geometry as WKT.
+
     crs : pyproj.crs or str, optional
         Set coordinate reference system. The value can be anything accepted
         by pyproj.CRS.from_user_input(), such as an authority string
@@ -317,7 +323,7 @@ def read_staypoints_csv(*args, columns=None, tz=None, index_col=object(), crs=No
     df = df.rename(columns=columns)
 
     # construct geom column
-    df["geom"] = df["geom"].apply(wkt.loads)
+    df[geom_col] = df[geom_col].apply(wkt.loads)
 
     # transform to datatime
     df["started_at"] = pd.to_datetime(df["started_at"])
@@ -368,7 +374,7 @@ def write_staypoints_csv(staypoints, filename, *args, **kwargs):
     df.to_csv(filename, index=True, *args, **kwargs)
 
 
-def read_locations_csv(*args, columns=None, index_col=object(), crs=None, **kwargs):
+def read_locations_csv(*args, columns=None, index_col=object(), geom_col="geom", crs=None, **kwargs):
     """
     Read locations from csv file.
 
@@ -472,7 +478,7 @@ def write_locations_csv(locations, filename, *args, **kwargs):
     df.to_csv(filename, index=True, *args, **kwargs)
 
 
-def read_trips_csv(*args, columns=None, tz=None, index_col=object(), **kwargs):
+def read_trips_csv(*args, columns=None, tz=None, index_col=object(), geom_col=None, crs=None, **kwargs):
     """
     Read trips from csv file.
 
@@ -498,6 +504,15 @@ def read_trips_csv(*args, columns=None, tz=None, index_col=object(), **kwargs):
         column name to be used as index. If None the default index is assumed
         as unique identifier.
 
+    geom_col : str, default None
+        Name of the column containing the geometry as WKT.
+        If None no geometry gets added.
+
+    crs : pyproj.crs or str, optional
+        Set coordinate reference system. The value can be anything accepted
+        by pyproj.CRS.from_user_input(), such as an authority string
+        (eg “EPSG:4326”) or a WKT string. Ignored if geom_col is None.
+
     kwargs
         Additional keyword arguments passed to pd.read_csv().
 
@@ -508,7 +523,7 @@ def read_trips_csv(*args, columns=None, tz=None, index_col=object(), **kwargs):
 
     Notes
     -----
-    No geometry is required for trackintel trips.
+    Geometry is not mandatory for trackintel trips.
 
     Examples
     --------
@@ -546,9 +561,9 @@ def read_trips_csv(*args, columns=None, tz=None, index_col=object(), **kwargs):
             trips[col] = _localize_timestamp(dt_series=trips[col], pytz_tzinfo=tz, col_name=col)
 
     # convert to geodataframe
-    if "geom" in trips.columns:
-        trips["geom"] = trips["geom"].apply(wkt.loads)
-        trips = gpd.GeoDataFrame(trips, geometry="geom")
+    if geom_col is not None:
+        trips[geom_col] = trips[geom_col].apply(wkt.loads)
+        trips = gpd.GeoDataFrame(trips, geometry=geom_col, crs=crs)
 
     # assert validity of trips
     trips.as_trips
diff --git a/trackintel/model/__init__.py b/trackintel/model/__init__.py
index f94f55f..f24d9dd 100644
--- a/trackintel/model/__init__.py
+++ b/trackintel/model/__init__.py
@@ -3,5 +3,4 @@ from .staypoints import StaypointsAccessor
 from .triplegs import TriplegsAccessor
 from .locations import LocationsAccessor
 from .trips import TripsAccessor
-from .users import UsersAccessor
 from .tours import ToursAccessor
diff --git a/trackintel/model/users.py b/trackintel/model/users.py
deleted file mode 100644
index 01f391c..0000000
--- a/trackintel/model/users.py
+++ /dev/null
@@ -1,44 +0,0 @@
-import pandas as pd
-import trackintel as ti
-
-
-@pd.api.extensions.register_dataframe_accessor("as_users")
-class UsersAccessor(object):
-    """A pandas accessor to treat DataFrames as collections of users.
-
-    This will define certain methods and accessors, as well as make sure that the DataFrame
-    adheres to some requirements.
-
-    Requires at least the following columns:
-    ['id']
-
-    For several usecases, the following additional columns are required:
-    ['attributes', 'geom_home', 'geom_work']
-
-    Examples
-    --------
-    >>> df.as_users.plot_home_and_work()
-    """
-
-    required_columns = ["id"]
-
-    def __init__(self, pandas_obj):
-        self._validate(pandas_obj)
-        self._obj = pandas_obj
-
-    @staticmethod
-    def _validate(obj):
-        if any([c not in obj.columns for c in UsersAccessor.required_columns]):
-            raise AttributeError(
-                "To process a DataFrame as a collection of users, "
-                + "it must have the properties [%s], but it has [%s]."
-                % (", ".join(UsersAccessor.required_columns), ", ".join(obj.columns))
-            )
-
-    def plot_home_and_work(self):
-        """
-        Plot home and work locations of users.
-
-        See :func:`trackintel.visualization.users.plot_home_and_work`.
-        """
-        raise NotImplementedError
diff --git a/trackintel/preprocessing/trips.py b/trackintel/preprocessing/trips.py
index 53aa921..bb74cf0 100644
--- a/trackintel/preprocessing/trips.py
+++ b/trackintel/preprocessing/trips.py
@@ -19,12 +19,15 @@ def get_trips_grouped(trips, tours):
     tours: GeoDataFrame (as trackintel tours)
         Output of generate_tours function, must contain column "trips" with list of trip ids on tour
 
-
     Returns
     -------
     trips_grouped_by_tour: DataFrameGroupBy object
         Trips grouped by tour id
 
+    Examples
+    --------
+    >>> get_trips_grouped(trips, tours)
+
     Notes
     -------
     This function is necessary because when running generate_tours, one trip only gets the tour ID of the smallest
@@ -91,6 +94,10 @@ def generate_tours(
     tours: GeoDataFrame (as trackintel tours)
         The generated tours
 
+    Examples
+    --------
+    >>> trips.as_trips.generate_tours(staypoints)
+
     Notes
     -------
     - Tours are defined as a collection of trips in a certain time frame that start and end at the same point
diff --git a/trackintel/preprocessing/util.py b/trackintel/preprocessing/util.py
index 04c6874..5f28ee8 100644
--- a/trackintel/preprocessing/util.py
+++ b/trackintel/preprocessing/util.py
@@ -5,7 +5,7 @@ from tqdm import tqdm
 
 def calc_temp_overlap(start_1, end_1, start_2, end_2):
     """
-    Calculate the portion of the first time span that overlaps with the second
+    Calculate the portion of the first time span that overlaps with the second.
 
     Parameters
     ----------
@@ -21,7 +21,11 @@ def calc_temp_overlap(start_1, end_1, start_2, end_2):
     Returns
     -------
     float:
-        The ratio by which the
+        The ratio by which the first timespan overlaps with the second.
+
+    Examples
+    --------
+    >>> ti.preprocessing.calc_temp_overlap(start_1, end_1, start_2, end_2)
 
     """
 
@@ -94,6 +98,11 @@ def applyParallel(dfGrouped, func, n_jobs, print_progress, **kwargs):
     -------
     pd.DataFrame:
         The result of dfGrouped.apply(func)
+
+    Examples
+    --------
+    >>> from trackintel.preprocessing.util import applyParallel
+    >>> applyParallel(tpfs.groupby("user_id", as_index=False), func, n_jobs=2)
     """
     df_ls = Parallel(n_jobs=n_jobs)(
         delayed(func)(group, **kwargs) for _, group in tqdm(dfGrouped, disable=not print_progress)
diff --git a/trackintel/visualization/osm.py b/trackintel/visualization/osm.py
index 992402f..9863fb3 100644
--- a/trackintel/visualization/osm.py
+++ b/trackintel/visualization/osm.py
@@ -1,12 +1,12 @@
 import logging
 
 import osmnx as ox
-from networkx.exception import NetworkXPointlessConcept
 from matplotlib.collections import LineCollection
+from networkx.exception import NetworkXPointlessConcept
 
 
 def plot_osm_streets(north, south, east, west, ax):
-    """Plots OpenStreetMap streets onto an axis.
+    """Plots with osmnx OpenStreetMap streets onto an axis.
 
     Parameters
     ----------
@@ -21,6 +21,13 @@ def plot_osm_streets(north, south, east, west, ax):
 
     west : float
         The westernmost coordinate.
+
+    ax : matplotlib.pyplot.Artist, optional
+        Axis on which to draw the plot.
+
+    Examples
+    --------
+    >>> ti.visualization.osm.plot_osm_street(47.392, 47.364, 8.557, 8.509, ax)
     """
     try:
         G = ox.graph_from_bbox(north, south, east, west, network_type="drive")
diff --git a/trackintel/visualization/util.py b/trackintel/visualization/util.py
index 2e77f94..063440a 100644
--- a/trackintel/visualization/util.py
+++ b/trackintel/visualization/util.py
@@ -1,15 +1,10 @@
-import time
 import logging
-import warnings
+import time
 
 import matplotlib
 import matplotlib.pyplot as plt
 import numpy as np
-
-from functools import partial
 from pint import UnitRegistry
-from shapely.geometry import Point
-
 
 ureg = UnitRegistry()
 
@@ -32,6 +27,10 @@ def a4_figsize(fig_height_mm=None, columns=2):
     -------
     (float, float)
         The width and height in which to plot a figure to fit on an A4 sheet.
+
+    Examples
+    --------
+    >>> ti.visualization.util.a4_figsize(columns=4)
     """
     if columns == 1:
         fig_width_mm = 84.0
@@ -100,6 +99,10 @@ def save_fig(out_filename, tight="tight", formats=["png", "pdf"]):
         How the bounding box should be drawn.
     formats : list
         A list denoting in which formats this figure should be saved ('png' or 'pdf').
+
+    Examples
+    --------
+    >>> ti.visualization.util("figure", formats=["png"])
     """
 
     if out_filename.endswith(".png"):


Test patch:
diff --git a/tests/model/test_trips.py b/tests/model/test_trips.py
index f2b87ab..a418894 100644
--- a/tests/model/test_trips.py
+++ b/tests/model/test_trips.py
@@ -8,7 +8,8 @@ import trackintel as ti
 @pytest.fixture
 def testdata_trips():
     """Read trips test data from file."""
-    test_trips = ti.read_trips_csv(os.path.join("tests", "data", "geolife_long", "trips.csv"), index_col="id")
+    path = os.path.join("tests", "data", "geolife_long", "trips.csv")
+    test_trips = ti.read_trips_csv(path, index_col="id", geom_col="geom")
     return test_trips
 
 
diff --git a/tests/model/test_users.py b/tests/model/test_users.py
deleted file mode 100644
index efec648..0000000
--- a/tests/model/test_users.py
+++ /dev/null
@@ -1,20 +0,0 @@
-import os
-import pytest
-
-import trackintel as ti
-
-
-class TestUsers:
-    """Tests for the UsersAccessor."""
-
-    def test_accessor(self):
-        """Test if the as_users accessor checks the required column for users."""
-        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife_long"))
-
-        users = pfs.groupby("user_id", as_index=False).mean()
-        users.rename(columns={"user_id": "id"}, inplace=True)
-        assert users.as_users
-
-        users = users.drop(["id"], axis=1)
-        with pytest.raises(AttributeError):
-            users.as_users
diff --git a/tests/preprocessing/test_triplegs.py b/tests/preprocessing/test_triplegs.py
index 11f8e8e..fc7ad42 100644
--- a/tests/preprocessing/test_triplegs.py
+++ b/tests/preprocessing/test_triplegs.py
@@ -78,7 +78,8 @@ class TestGenerate_trips:
     def test_generate_trips(self, example_triplegs_higher_gap_threshold):
         """Test if we can generate the example trips based on example data."""
         # load pregenerated trips
-        trips_loaded = ti.read_trips_csv(os.path.join("tests", "data", "geolife_long", "trips.csv"), index_col="id")
+        path = os.path.join("tests", "data", "geolife_long", "trips.csv")
+        trips_loaded = ti.read_trips_csv(path, index_col="id", geom_col="geom", crs=None)
 
         # create trips from geolife (based on positionfixes) - with gap_threshold 1e6
         sp, tpls = example_triplegs_higher_gap_threshold
diff --git a/tests/preprocessing/test_trips.py b/tests/preprocessing/test_trips.py
index bf3c86d..0aa69f4 100644
--- a/tests/preprocessing/test_trips.py
+++ b/tests/preprocessing/test_trips.py
@@ -234,12 +234,12 @@ class TestGenerate_tours:
 
     def test_generate_tours_geolife(self):
         """Test tour generation also on the geolife dataset"""
-        trips = ti.io.file.read_trips_csv(os.path.join("tests", "data", "geolife_long", "trips.csv"), index_col="id")
+        path_trips = os.path.join("tests", "data", "geolife_long", "trips.csv")
+        trips = ti.io.file.read_trips_csv(path_trips, index_col="id", geom_col="geom", crs="EPSG:4326")
         _, tours = ti.preprocessing.trips.generate_tours(trips, max_dist=100)
 
-        tours_loaded = ti.io.file.read_tours_csv(
-            os.path.join("tests", "data", "geolife_long", "tours.csv"), index_col="id"
-        )
+        path_tours = os.path.join("tests", "data", "geolife_long", "tours.csv")
+        tours_loaded = ti.io.file.read_tours_csv(path_tours, index_col="id")
         # check only first five columns because location ID is empty in this case
         pd.testing.assert_frame_equal(tours_loaded.iloc[:, :5], tours.iloc[:, :5])