Repository: mie-lab/trackintel (language: python)

Issue:
Code style using black
We could consider using [black](https://github.com/psf/black) as our code formatter. 
They provide [GitHub Actions](https://github.com/psf/black/blob/master/README.md#github-actions) for formatting the pull requests.
We can then also add their [badge](https://img.shields.io/badge/code%20style-black-000000.svg) 


Discussion / hints:
Yes! I am strongly in favor. We just have to make sure that we have a single pull request that changes the codestyle in all files and does nothing else. 
We also have to make sure that we have the same configuration for black. I would be OK with the default even if this means to switch to a line length of 79 characters. 

Fix patch:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 30a2ef64..02f62d3a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -29,6 +29,9 @@ There are travis and appveyor CIs set up for Unix/Windows builds.
 You can find the corresponding scripts in `.travis.yml` and `appveyor.yml`.
 Adding [Coveralls](https://coveralls.io) is an open todo.
 
+### Formatting
+We use [black](https://github.com/psf/black) as our code formatter, run `python -m black . -l 120` in the *trackintel* folder to format your code automatically into black style. Please be sure to format your code before making a pull request.
+
 ## Coding conventions
 This is a place to collect conventions we agreed upon until we find the right place in the doc for them
 
diff --git a/README.md b/README.md
index b1ab5ad8..f530dab6 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,8 @@
 [![Build Status](https://travis-ci.org/mie-lab/trackintel.svg?branch=master)](https://travis-ci.org/mie-lab/trackintel)
 [![Documentation Status](https://readthedocs.org/projects/trackintel/badge/?version=latest)](https://trackintel.readthedocs.io/en/latest/?badge=latest)
 [![codecov.io](https://codecov.io/gh/mie-lab/trackintel/coverage.svg?branch=master)](https://codecov.io/gh/mie-lab/trackintel)
-          
+[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
+   
 *trackintel* is a library for the analysis of spatio-temporal tracking data with a focus on human mobility. The core of *trackintel* is the hierachical data model for movement data that is used in transport planning [[1]](#1). We provide functionalities for the full life-cycle of human mobility data analysis: import and export of tracking data of different types (e.g, trackpoints, check-ins, trajectories), preprocessing, data quality assessment, semantic enrichment, quantitative analysis and mining tasks, and visualization of data and results.
 Trackintel is based on [Pandas](https://pandas.pydata.org/) and [GeoPandas](https://geopandas.org/#)
 
diff --git a/docs/conf.py b/docs/conf.py
index 12f58ba3..77354f3a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -150,15 +150,7 @@ def setup(app):
 # default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
 # 'searchbox.html']``.
 #
-html_sidebars = {
-    "**": [
-        "about.html",
-        "navigation.html",
-        "relations.html",
-        "searchbox.html",
-        "donate.html",
-    ]
-}
+html_sidebars = {"**": ["about.html", "navigation.html", "relations.html", "searchbox.html", "donate.html",]}
 
 # only defined in 'Alabaster' html_theme
 # html_theme_options = {
diff --git a/examples/import_export_postgis.py b/examples/import_export_postgis.py
index b677e509..e035b0e4 100644
--- a/examples/import_export_postgis.py
+++ b/examples/import_export_postgis.py
@@ -1,5 +1,6 @@
 # This is not needed if the trackintel library is installed. ==================
 import sys
+
 sys.path.append("..")
 sys.path.append("../trackintel")
 # =============================================================================
@@ -10,12 +11,12 @@
 import trackintel as ti
 
 
-logging.basicConfig(filename='examples/log/import_export_postgis.log', level=logging.INFO, filemode='w')
+logging.basicConfig(filename="examples/log/import_export_postgis.log", level=logging.INFO, filemode="w")
 
-conn_string = 'postgresql://test:1234@localhost:5432/trackintel-tests'
+conn_string = "postgresql://test:1234@localhost:5432/trackintel-tests"
 
 # Geolife trajectory to PostGIS.
-pfs = ti.read_positionfixes_csv('examples/data/geolife_trajectory.csv', sep=';')
+pfs = ti.read_positionfixes_csv("examples/data/geolife_trajectory.csv", sep=";")
 # pfs.as_positionfixes.to_postgis(conn_string, 'positionfixes')
 
 # Geolife trajectory from PostGIS.
diff --git a/examples/preprocess_trajectories.py b/examples/preprocess_trajectories.py
index b9e6521b..12da0299 100644
--- a/examples/preprocess_trajectories.py
+++ b/examples/preprocess_trajectories.py
@@ -1,5 +1,6 @@
 # This is not needed if the trackintel library is installed. ==================
 import sys
+
 sys.path.append("..")
 sys.path.append("../trackintel")
 # =============================================================================
@@ -10,42 +11,53 @@
 
 import trackintel as ti
 
-logging.basicConfig(filename='examples/log/preprocessing.log', level=logging.INFO, filemode='w')
+logging.basicConfig(filename="examples/log/preprocessing.log", level=logging.INFO, filemode="w")
 
 # GPS trajectory.
-pfs = ti.read_positionfixes_csv('examples/data/geolife_trajectory.csv', sep=';', crs='EPSG:4326', index_col=None)
-pfs.as_positionfixes.plot(out_filename='examples/out/gps_trajectory_positionfixes.png', plot_osm=True)
-
-_, spts = pfs.as_positionfixes.generate_staypoints(method='sliding', dist_threshold=100, time_threshold=5)
-spts.as_staypoints.plot(out_filename='examples/out/gps_trajectory_staypoints.png',
-                        radius=100, positionfixes=pfs, plot_osm=True)
-
-_, locs = spts.as_staypoints.generate_locations(method='dbscan', epsilon=0.01, num_samples=3)
-locs.as_locations.plot(out_filename='examples/out/gps_trajectory_locations.png', radius=120,
-                       positionfixes=pfs, staypoints=spts, staypoints_radius=100,
-                       plot_osm=True)
+pfs = ti.read_positionfixes_csv("examples/data/geolife_trajectory.csv", sep=";", crs="EPSG:4326", index_col=None)
+pfs.as_positionfixes.plot(out_filename="examples/out/gps_trajectory_positionfixes.png", plot_osm=True)
+
+_, spts = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=100, time_threshold=5)
+spts.as_staypoints.plot(
+    out_filename="examples/out/gps_trajectory_staypoints.png", radius=100, positionfixes=pfs, plot_osm=True
+)
+
+_, locs = spts.as_staypoints.generate_locations(method="dbscan", epsilon=0.01, num_samples=3)
+locs.as_locations.plot(
+    out_filename="examples/out/gps_trajectory_locations.png",
+    radius=120,
+    positionfixes=pfs,
+    staypoints=spts,
+    staypoints_radius=100,
+    plot_osm=True,
+)
 
 _, tpls = pfs.as_positionfixes.generate_triplegs(stps_input=spts)
-tpls.as_triplegs.plot(out_filename='examples/out/gpsies_trajectory_triplegs.png', staypoints=spts,
-                      staypoints_radius=100, plot_osm=True)
+tpls.as_triplegs.plot(
+    out_filename="examples/out/gpsies_trajectory_triplegs.png", staypoints=spts, staypoints_radius=100, plot_osm=True
+)
 
 # Geolife trajectory.
-pfs = ti.read_positionfixes_csv('examples/data/geolife_trajectory.csv', sep=';', crs='EPSG:4326', index_col=None)
-pfs.as_positionfixes.plot(out_filename='examples/out/geolife_trajectory_positionfixes.png', plot_osm=False)
+pfs = ti.read_positionfixes_csv("examples/data/geolife_trajectory.csv", sep=";", crs="EPSG:4326", index_col=None)
+pfs.as_positionfixes.plot(out_filename="examples/out/geolife_trajectory_positionfixes.png", plot_osm=False)
 
-_, spts = pfs.as_positionfixes.generate_staypoints(method='sliding', dist_threshold=100, time_threshold=10)
-spts.as_staypoints.plot(out_filename='examples/out/geolife_trajectory_staypoints.png',
-                        radius=100, positionfixes=pfs, plot_osm=True)
+_, spts = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=100, time_threshold=10)
+spts.as_staypoints.plot(
+    out_filename="examples/out/geolife_trajectory_staypoints.png", radius=100, positionfixes=pfs, plot_osm=True
+)
 
 # Google trajectory.
-pfs = ti.read_positionfixes_csv('examples/data/google_trajectory.csv', sep=';', crs='EPSG:4326', index_col=None)
-_, spts = pfs.as_positionfixes.generate_staypoints(method='sliding', dist_threshold=75, time_threshold=10)
-spts.as_staypoints.plot(out_filename='examples/out/google_trajectory_staypoints.png',
-                        radius=75, positionfixes=pfs, plot_osm=True)
+pfs = ti.read_positionfixes_csv("examples/data/google_trajectory.csv", sep=";", crs="EPSG:4326", index_col=None)
+_, spts = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=75, time_threshold=10)
+spts.as_staypoints.plot(
+    out_filename="examples/out/google_trajectory_staypoints.png", radius=75, positionfixes=pfs, plot_osm=True
+)
 
 # Posmo trajectory.
-pfs = ti.read_positionfixes_csv('examples/data/posmo_trajectory.csv', sep=';', crs='EPSG:4326', index_col=None,
-                                tz='UTC')
-_, spts = pfs.as_positionfixes.generate_staypoints(method='sliding', dist_threshold=50, time_threshold=1)
-spts.as_staypoints.plot(out_filename='examples/out/posmo_trajectory_staypoints.png',
-                        radius=50, positionfixes=pfs, plot_osm=False)
+pfs = ti.read_positionfixes_csv(
+    "examples/data/posmo_trajectory.csv", sep=";", crs="EPSG:4326", index_col=None, tz="UTC"
+)
+_, spts = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=50, time_threshold=1)
+spts.as_staypoints.plot(
+    out_filename="examples/out/posmo_trajectory_staypoints.png", radius=50, positionfixes=pfs, plot_osm=False
+)
diff --git a/examples/setup_example_database.py b/examples/setup_example_database.py
index 097af1d1..cb858f8d 100644
--- a/examples/setup_example_database.py
+++ b/examples/setup_example_database.py
@@ -8,11 +8,11 @@
 
 # This script will remove the following table from your database!
 # It will then, however, repopulate it with new data.
-database_name = 'trackintel-tests'
-logging.basicConfig(filename='log/setup_example_database.log', level=logging.INFO, filemode='w')
+database_name = "trackintel-tests"
+logging.basicConfig(filename="log/setup_example_database.log", level=logging.INFO, filemode="w")
 
 try:
-    con = psycopg2.connect(user='test', host='localhost', port='5432', password='1234', dbname='postgres')
+    con = psycopg2.connect(user="test", host="localhost", port="5432", password="1234", dbname="postgres")
     con.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
     cur = con.cursor()
     cur.execute(f"""SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='{database_name}'""")
@@ -21,9 +21,9 @@
     con.commit()
     con.close()
 
-    con = psycopg2.connect(user='test', host='localhost', port='5432', password='1234', dbname=database_name)
+    con = psycopg2.connect(user="test", host="localhost", port="5432", password="1234", dbname=database_name)
     cur = con.cursor()
-    cur.execute(open('../sql/create_tables_pg.sql', 'r').read())
+    cur.execute(open("../sql/create_tables_pg.sql", "r").read())
     con.commit()
     con.close()
 except Exception as e:
@@ -31,8 +31,8 @@
     traceback.print_exc()
 
 # Now we fill in some new data.
-conn_string = 'postgresql://test:1234@localhost:5432/' + database_name
-pfs = ti.read_positionfixes_csv('data/posmo_trajectory_2.csv', sep=';')
-pfs.as_positionfixes.to_postgis(conn_string, 'positionfixes', if_exists='append')
+conn_string = "postgresql://test:1234@localhost:5432/" + database_name
+pfs = ti.read_positionfixes_csv("data/posmo_trajectory_2.csv", sep=";")
+pfs.as_positionfixes.to_postgis(conn_string, "positionfixes", if_exists="append")
 
 # We use the trackintel functionality to fill consecutive tables.
diff --git a/setup.py b/setup.py
index 09ad4784..bc20126d 100644
--- a/setup.py
+++ b/setup.py
@@ -10,44 +10,44 @@
 from setuptools import find_packages, setup
 
 # Package meta-data.
-NAME = 'trackintel'
-DESCRIPTION = 'Human mobility and movement analysis framework.'
-URL = 'https://github.com/mie-lab/trackintel'
-EMAIL = 'dobucher@ethz.ch, martinhe@ethz.ch'
-AUTHOR = 'Dominik Bucher, Henry Martin, Ye Hong'
-REQUIRES_PYTHON = '>=3.6.0'
+NAME = "trackintel"
+DESCRIPTION = "Human mobility and movement analysis framework."
+URL = "https://github.com/mie-lab/trackintel"
+EMAIL = "dobucher@ethz.ch, martinhe@ethz.ch"
+AUTHOR = "Dominik Bucher, Henry Martin, Ye Hong"
+REQUIRES_PYTHON = ">=3.6.0"
 VERSION = None
-LICENSE = 'MIT'
+LICENSE = "MIT"
 
 # What packages are required for this module to be executed?
 REQUIRED = [
-    'pandas',
-    'geopandas',
-    'matplotlib',
-    'numpy',
-    'pint',
-    'shapely',
-    'networkx',
-    'geoalchemy2',
-    'osmnx',
-    'scikit-learn',
-    'tqdm',
-    'similaritymeasures',
+    "pandas",
+    "geopandas",
+    "matplotlib",
+    "numpy",
+    "pint",
+    "shapely",
+    "networkx",
+    "geoalchemy2",
+    "osmnx",
+    "scikit-learn",
+    "tqdm",
+    "similaritymeasures",
 ]
 
 install_requires = [
-    'pandas',
-    'matplotlib',
-    'numpy',
-    'pint',
-    'shapely',
-    'networkx',
-    'geoalchemy2',
-    'osmnx',
-    'scikit-learn',
-    'tqdm',
-    'geopandas',
-    'similaritymeasures',
+    "pandas",
+    "matplotlib",
+    "numpy",
+    "pint",
+    "shapely",
+    "networkx",
+    "geoalchemy2",
+    "osmnx",
+    "scikit-learn",
+    "tqdm",
+    "geopandas",
+    "similaritymeasures",
 ]
 
 # What packages are optional?
@@ -65,34 +65,33 @@
 # Import the README and use it as the long-description.
 # Note: this will only work if 'README.md' is present in your MANIFEST.in file!
 try:
-    with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
-        long_description = '\n' + f.read()
+    with io.open(os.path.join(here, "README.md"), encoding="utf-8") as f:
+        long_description = "\n" + f.read()
 except FileNotFoundError:
     long_description = DESCRIPTION
 
 # Load the package's __version__.py module as a dictionary.
 about = {}
 if not VERSION:
-    with open(os.path.join(here, NAME, '__version__.py')) as f:
+    with open(os.path.join(here, NAME, "__version__.py")) as f:
         exec(f.read(), about)
 else:
-    about['__version__'] = VERSION
+    about["__version__"] = VERSION
 
 # Where the magic happens:
 setup(
     name=NAME,
-    version=about['__version__'],
+    version=about["__version__"],
     description=DESCRIPTION,
     long_description=long_description,
-    long_description_content_type='text/markdown',
+    long_description_content_type="text/markdown",
     author=AUTHOR,
     author_email=EMAIL,
     python_requires=REQUIRES_PYTHON,
     url=URL,
-    packages=find_packages(exclude=('tests',)),
+    packages=find_packages(exclude=("tests",)),
     # If your package is a single module, use this instead of 'packages':
     # py_modules=['mypackage'],
-
     # entry_points={
     #     'console_scripts': ['mycli=mymodule:cli'],
     # },
@@ -103,10 +102,10 @@
     classifiers=[
         # Trove classifiers
         # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
-        'License :: OSI Approved :: MIT License',
-        'Programming Language :: Python',
-        'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.6'
+        "License :: OSI Approved :: MIT License",
+        "Programming Language :: Python",
+        "Programming Language :: Python :: 3",
+        "Programming Language :: Python :: 3.6",
     ],
     # $ setup.py publish support.
     cmdclass={
diff --git a/trackintel/__init__.py b/trackintel/__init__.py
index fbc63a79..7b3fdf41 100644
--- a/trackintel/__init__.py
+++ b/trackintel/__init__.py
@@ -1,4 +1,4 @@
 from .core import *
 from .model import *
 from .io import *
-from .analysis import *
\ No newline at end of file
+from .analysis import *
diff --git a/trackintel/__version__.py b/trackintel/__version__.py
index c0166557..8ad2d3c0 100644
--- a/trackintel/__version__.py
+++ b/trackintel/__version__.py
@@ -1,3 +1,3 @@
 VERSION = (0, 5, 3)
 
-__version__ = '.'.join(map(str, VERSION))
+__version__ = ".".join(map(str, VERSION))
diff --git a/trackintel/analysis/__init__.py b/trackintel/analysis/__init__.py
index 71d18416..2433d95d 100644
--- a/trackintel/analysis/__init__.py
+++ b/trackintel/analysis/__init__.py
@@ -1,2 +1,2 @@
 from .transport_mode_identification import predict_transport_mode
-from .tracking_quality import temporal_tracking_quality
\ No newline at end of file
+from .tracking_quality import temporal_tracking_quality
diff --git a/trackintel/analysis/modal_split.py b/trackintel/analysis/modal_split.py
index 9e2936b4..34986f52 100644
--- a/trackintel/analysis/modal_split.py
+++ b/trackintel/analysis/modal_split.py
@@ -1,11 +1,10 @@
 import numpy as np
 import pandas as pd
 
-from trackintel.geogr.distances import check_wgs_for_distance_calculation, \
-    calculate_haversine_length
+from trackintel.geogr.distances import check_wgs_for_distance_calculation, calculate_haversine_length
 
 
-def calculate_modal_split(tpls_in, freq=None, metric='count', per_user=False, norm=False):
+def calculate_modal_split(tpls_in, freq=None, metric="count", per_user=False, norm=False):
     """Calculate the modal split of triplegs
 
     Parameters
@@ -48,55 +47,55 @@ def calculate_modal_split(tpls_in, freq=None, metric='count', per_user=False, no
     tpls = tpls_in.copy()
 
     # precalculate distance and duration if required
-    if metric == 'distance':
+    if metric == "distance":
         wgs = check_wgs_for_distance_calculation(tpls.crs)
         if wgs:
-            tpls['distance'] = calculate_haversine_length(tpls)
+            tpls["distance"] = calculate_haversine_length(tpls)
         else:
-            tpls['distance'] = tpls.length
-    elif metric == 'duration':
-        tpls['duration'] = tpls['finished_at'] - tpls['started_at']
+            tpls["distance"] = tpls.length
+    elif metric == "duration":
+        tpls["duration"] = tpls["finished_at"] - tpls["started_at"]
 
     # create grouper
     if freq is None:
         if per_user:
-            tpls_grouper = tpls.groupby(['user_id', 'mode'])
+            tpls_grouper = tpls.groupby(["user_id", "mode"])
         else:
-            tpls_grouper = tpls.groupby(['mode'])
+            tpls_grouper = tpls.groupby(["mode"])
     else:
-        tpls.set_index('started_at', inplace=True)
-        tpls.index.name = 'timestamp'
+        tpls.set_index("started_at", inplace=True)
+        tpls.index.name = "timestamp"
         if per_user:
-            tpls_grouper = tpls.groupby(['user_id', 'mode', pd.Grouper(freq=freq)])
+            tpls_grouper = tpls.groupby(["user_id", "mode", pd.Grouper(freq=freq)])
         else:
-            tpls_grouper = tpls.groupby(['mode', pd.Grouper(freq=freq)])
+            tpls_grouper = tpls.groupby(["mode", pd.Grouper(freq=freq)])
 
     # aggregate
-    if metric == 'count':
-        modal_split = tpls_grouper['mode'].count()
+    if metric == "count":
+        modal_split = tpls_grouper["mode"].count()
 
-    elif metric == 'distance':
-        modal_split = tpls_grouper['distance'].sum()
+    elif metric == "distance":
+        modal_split = tpls_grouper["distance"].sum()
 
-    elif metric == 'duration':
-        modal_split = tpls_grouper['duration'].sum()
+    elif metric == "duration":
+        modal_split = tpls_grouper["duration"].sum()
         modal_split = modal_split.dt.total_seconds()
 
     # move 'mode' to columns
-    modal_split.name = 'modal_split'
+    modal_split.name = "modal_split"
     modal_split = pd.DataFrame(modal_split)
 
     # if mode is the only index, we replace it with zeros so that everything gets aggregated into a single row
-    modal_split['mode'] = modal_split.index.get_level_values('mode')
+    modal_split["mode"] = modal_split.index.get_level_values("mode")
     if modal_split.index.nlevels == 1:
         modal_split.index = 0 * np.arange(0, modal_split.shape[0])
     else:
-        modal_split = modal_split.droplevel('mode')
+        modal_split = modal_split.droplevel("mode")
 
     # transform Dataframe such that:
     # - unique mode names are column names
     # - time/user_id are the indices
-    modal_split = modal_split.pivot_table(index=modal_split.index, columns='mode', values='modal_split')
+    modal_split = modal_split.pivot_table(index=modal_split.index, columns="mode", values="modal_split")
     modal_split.fillna(0, inplace=True)
 
     if norm:
diff --git a/trackintel/analysis/tracking_quality.py b/trackintel/analysis/tracking_quality.py
index 8819db88..b9907952 100644
--- a/trackintel/analysis/tracking_quality.py
+++ b/trackintel/analysis/tracking_quality.py
@@ -53,10 +53,12 @@ def temporal_tracking_quality(source, granularity="all"):
     """
     required_columns = ["user_id", "started_at", "finished_at"]
     if any([c not in source.columns for c in required_columns]):
-        raise KeyError("To successfully calculate the user-level tracking quality, " \
-            + "the source dataframe must have the columns [%s], but it has [%s]." \
-            % (', '.join(required_columns), ', '.join(source.columns)))
-            
+        raise KeyError(
+            "To successfully calculate the user-level tracking quality, "
+            + "the source dataframe must have the columns [%s], but it has [%s]."
+            % (", ".join(required_columns), ", ".join(source.columns))
+        )
+
     df = source.copy()
     df.reset_index(inplace=True)
     if granularity == "all":
@@ -272,4 +274,4 @@ def __get_split_index(df, granularity="day"):
         # union of day and hour change flag
         change_flag = change_flag | hour_flag
 
-    return change_flag
\ No newline at end of file
+    return change_flag
diff --git a/trackintel/analysis/transport_mode_identification.py b/trackintel/analysis/transport_mode_identification.py
index 26345503..afb75888 100644
--- a/trackintel/analysis/transport_mode_identification.py
+++ b/trackintel/analysis/transport_mode_identification.py
@@ -3,7 +3,7 @@
 from trackintel.geogr.distances import check_wgs_for_distance_calculation, calculate_haversine_length
 
 
-def predict_transport_mode(triplegs, method='simple-coarse', **kwargs):
+def predict_transport_mode(triplegs, method="simple-coarse", **kwargs):
     """
     Predict the transport mode of triplegs.
     
@@ -31,14 +31,15 @@ def predict_transport_mode(triplegs, method='simple-coarse', **kwargs):
     These categories are default values and can be overwritten using the keyword argument categories.
         
     """
-    if method == 'simple-coarse':
+    if method == "simple-coarse":
         # implemented as keyword argument if later other methods that don't use categories are added
-        categories = kwargs.pop('categories', {15 / 3.6: 'slow_mobility', 100 / 3.6: 'motorized_mobility',
-                                               np.inf: 'fast_mobility'})
+        categories = kwargs.pop(
+            "categories", {15 / 3.6: "slow_mobility", 100 / 3.6: "motorized_mobility", np.inf: "fast_mobility"}
+        )
 
         return predict_transport_mode_simple_coarse(triplegs, categories)
     else:
-        raise NameError(f'Method {method} not known for predicting tripleg transport modes.')
+        raise NameError(f"Method {method} not known for predicting tripleg transport modes.")
 
 
 def predict_transport_mode_simple_coarse(triplegs_in, categories):
@@ -73,15 +74,15 @@ def predict_transport_mode_simple_coarse(triplegs_in, categories):
 
     """
     if not (check_categories(categories)):
-        raise ValueError('the categories must be in increasing order')
+        raise ValueError("the categories must be in increasing order")
 
     triplegs = triplegs_in.copy()
     wgs = check_wgs_for_distance_calculation(triplegs.crs)
     #
     if wgs:
-        triplegs['distance'] = calculate_haversine_length(triplegs)
+        triplegs["distance"] = calculate_haversine_length(triplegs)
     else:
-        triplegs['distance'] = triplegs.length
+        triplegs["distance"] = triplegs.length
 
     def identify_mode(tripleg, categories):
         """
@@ -102,14 +103,14 @@ def identify_mode(tripleg, categories):
             the identified mode.
         """
 
-        duration = (tripleg['finished_at'] - tripleg['started_at']).total_seconds()
-        speed = tripleg['distance'] / duration  # The unit of the speed is m/s
+        duration = (tripleg["finished_at"] - tripleg["started_at"]).total_seconds()
+        speed = tripleg["distance"] / duration  # The unit of the speed is m/s
 
         for bound in categories:
             if speed < bound:
                 return categories[bound]
 
-    triplegs['mode'] = triplegs.apply(identify_mode, args=((categories,)), axis=1)
+    triplegs["mode"] = triplegs.apply(identify_mode, args=((categories,)), axis=1)
     return triplegs
 
 
diff --git a/trackintel/core.py b/trackintel/core.py
index 2bca973d..1a54459f 100644
--- a/trackintel/core.py
+++ b/trackintel/core.py
@@ -3,6 +3,10 @@
 
 def print_version():
     """Prints the framework version."""
-    
-    print("This is trackintel v" + str(__version__.__version__) + ". You can find more information " \
-        + "under https://github.com/mie-lab/trackintel. Thank you for using it!")
+
+    print(
+        "This is trackintel v"
+        + str(__version__.__version__)
+        + ". You can find more information "
+        + "under https://github.com/mie-lab/trackintel. Thank you for using it!"
+    )
diff --git a/trackintel/geogr/distances.py b/trackintel/geogr/distances.py
index 828db3ba..aa74d327 100644
--- a/trackintel/geogr/distances.py
+++ b/trackintel/geogr/distances.py
@@ -12,7 +12,7 @@
 from trackintel.geogr.point_distances import haversine_dist
 
 
-def calculate_distance_matrix(X, Y=None, dist_metric='haversine', n_jobs=0, **kwds):
+def calculate_distance_matrix(X, Y=None, dist_metric="haversine", n_jobs=0, **kwds):
     """
     Calculate a distance matrix based on a specific distance metric.
     
@@ -59,16 +59,17 @@ def calculate_distance_matrix(X, Y=None, dist_metric='haversine', n_jobs=0, **kw
     geom_type = X.geometry.iat[0].geom_type
     if Y is None:
         Y = X
-    assert Y.geometry.iat[0].geom_type == Y.geometry.iat[0].geom_type, "x and y need same geometry type " \
-                                                                       "(only first column checked)"
+    assert Y.geometry.iat[0].geom_type == Y.geometry.iat[0].geom_type, (
+        "x and y need same geometry type " "(only first column checked)"
+    )
 
-    if geom_type == 'Point':
+    if geom_type == "Point":
         x1 = X.geometry.x.values
         y1 = X.geometry.y.values
         x2 = Y.geometry.x.values
         y2 = Y.geometry.y.values
 
-        if dist_metric == 'haversine':
+        if dist_metric == "haversine":
             # create point pairs for distance calculation
             nx = len(X)
             ny = len(Y)
@@ -106,12 +107,12 @@ def calculate_distance_matrix(X, Y=None, dist_metric='haversine', n_jobs=0, **kw
 
         return D
 
-    elif geom_type == 'LineString':
+    elif geom_type == "LineString":
 
-        if dist_metric in ['dtw', 'frechet']:
+        if dist_metric in ["dtw", "frechet"]:
             # these are the preparation steps for all distance functions based only on coordinates
 
-            if dist_metric == 'dtw':
+            if dist_metric == "dtw":
                 d_fun = partial(similaritymeasures.dtw, **kwds)
             else:
                 d_fun = partial(similaritymeasures.frechet_dist, **kwds)
@@ -126,7 +127,7 @@ def calculate_distance_matrix(X, Y=None, dist_metric='haversine', n_jobs=0, **kw
             else:
                 ix_1, ix_2 = np.tril_indices(nx, k=-1, m=ny)
                 trilix = np.triu_indices(nx, k=1, m=ny)
-                
+
             # get the coordinates as list of each LineString
             left = list(X.iloc[ix_1].geometry.apply(lambda x: x.coords))
             right = list(Y.iloc[ix_2].geometry.apply(lambda x: x.coords))
@@ -140,9 +141,9 @@ def calculate_distance_matrix(X, Y=None, dist_metric='haversine', n_jobs=0, **kw
                     res = list(pool.starmap(d_fun, left_right))
             else:
                 res = list(map(d_fun, left, right))
-                
-            if dist_metric == 'dtw':
-                # the first return is the dtw distance, see docs of similaritymeasures.dtw 
+
+            if dist_metric == "dtw":
+                # the first return is the dtw distance, see docs of similaritymeasures.dtw
                 d = [dist[0] for dist in res]
             else:
                 d = res
@@ -154,8 +155,9 @@ def calculate_distance_matrix(X, Y=None, dist_metric='haversine', n_jobs=0, **kw
             return D
 
         else:
-            raise AttributeError("Metric unknown. We only support ['dtw', 'frechet'] for LineStrings. "
-                                 f"You passed {dist_metric}")
+            raise AttributeError(
+                "Metric unknown. We only support ['dtw', 'frechet'] for LineStrings. " f"You passed {dist_metric}"
+            )
     else:
         raise AttributeError(f"We only support 'Point' and 'LineString'. Your geometry is {geom_type}")
 
@@ -211,8 +213,9 @@ def check_wgs_for_distance_calculation(crs):
 
     elif crs is None:
         is_wgs = True
-        warnings.warn('Your data is not projected. WGS84 is assumed and for length calculation the haversine '
-                      'distance is used')
+        warnings.warn(
+            "Your data is not projected. WGS84 is assumed and for length calculation the haversine " "distance is used"
+        )
     return is_wgs
 
 
@@ -264,9 +267,9 @@ def _calculate_haversine_length_single(linestring):
     >>> _calculate_haversine_length_single(ls)
     """
 
-    coords_df = pd.DataFrame(linestring.xy, index=['x_0', 'y_0']).transpose()
-    coords_df['x_1'] = coords_df['x_0'].shift(-1)
-    coords_df['y_1'] = coords_df['y_0'].shift(-1)
+    coords_df = pd.DataFrame(linestring.xy, index=["x_0", "y_0"]).transpose()
+    coords_df["x_1"] = coords_df["x_0"].shift(-1)
+    coords_df["y_1"] = coords_df["y_0"].shift(-1)
     coords_df.dropna(axis=0, inplace=True)
 
     distances = haversine_dist(coords_df.x_0, coords_df.y_0, coords_df.x_1, coords_df.y_1)
diff --git a/trackintel/geogr/point_distances.py b/trackintel/geogr/point_distances.py
index 3d8ea78d..cc78167e 100644
--- a/trackintel/geogr/point_distances.py
+++ b/trackintel/geogr/point_distances.py
@@ -1,5 +1,6 @@
 import numpy as np
 
+
 def haversine_dist(lon_1, lat_1, lon_2, lat_2, r=6371000):
     """
     Compute the great circle or haversine distance between two coordinates in WGS84.
@@ -49,4 +50,4 @@ def haversine_dist(lon_1, lat_1, lon_2, lat_2, r=6371000):
     cos_lat_d = np.cos(lat_1 - lat_2)
     cos_lon_d = np.cos(lon_1 - lon_2)
 
-    return r * np.arccos(cos_lat_d - cos_lat1 * cos_lat2 * (1 - cos_lon_d))
\ No newline at end of file
+    return r * np.arccos(cos_lat_d - cos_lat1 * cos_lat2 * (1 - cos_lon_d))
diff --git a/trackintel/io/__init__.py b/trackintel/io/__init__.py
index 54862841..16243f99 100644
--- a/trackintel/io/__init__.py
+++ b/trackintel/io/__init__.py
@@ -29,4 +29,3 @@
 from .from_geopandas import read_trips_gpd
 
 from .dataset_reader import read_geolife
-
diff --git a/trackintel/io/dataset_reader.py b/trackintel/io/dataset_reader.py
index 99fe0b33..95fc1976 100644
--- a/trackintel/io/dataset_reader.py
+++ b/trackintel/io/dataset_reader.py
@@ -12,7 +12,7 @@
 
 FEET2METER = 0.3048
 
-CRS_WGS84 = 'epsg:4326'
+CRS_WGS84 = "epsg:4326"
 
 from trackintel.preprocessing.util import calc_temp_overlap
 
@@ -79,14 +79,14 @@ def read_geolife(geolife_path):
     ----------
     >>> geolife_pfs, labels = read_geolife(os.path.join('downloads', 'Geolife Trajectories 1.3'))
     """
-    geolife_path = os.path.join(geolife_path, '*')
+    geolife_path = os.path.join(geolife_path, "*")
     user_folder = sorted(glob.glob(geolife_path))
 
     df_list_users = []
     label_dict = dict()
 
     if len(user_folder) == 0:
-        raise NameError('No folders found with working directory {} and path {}'.format(os.getcwd(), geolife_path))
+        raise NameError("No folders found with working directory {} and path {}".format(os.getcwd(), geolife_path))
 
     for user_folder_this in user_folder:
 
@@ -96,11 +96,11 @@ def read_geolife(geolife_path):
 
         # check if labels are available
         try:
-            labels = pd.read_csv(os.path.join(user_folder_this, 'labels.txt'), delimiter="\t")
+            labels = pd.read_csv(os.path.join(user_folder_this, "labels.txt"), delimiter="\t")
             rename_dict = {"Start Time": "started_at", "End Time": "finished_at", "Transportation Mode": "mode"}
             labels.rename(rename_dict, axis=1, inplace=True)
-            labels['started_at'] = pd.to_datetime(labels['started_at'], format="%Y/%m/%d %H:%M:%S", utc=True)
-            labels['finished_at'] = pd.to_datetime(labels['finished_at'], format="%Y/%m/%d %H:%M:%S", utc=True)
+            labels["started_at"] = pd.to_datetime(labels["started_at"], format="%Y/%m/%d %H:%M:%S", utc=True)
+            labels["finished_at"] = pd.to_datetime(labels["finished_at"], format="%Y/%m/%d %H:%M:%S", utc=True)
         except OSError:
             labels = pd.DataFrame(columns=["started_at", "finished_at", "mode"])
 
@@ -109,32 +109,36 @@ def read_geolife(geolife_path):
         try:
             user_id = int(tail)
         except ValueError as err:
-            errmsg = "Invalid user_id '{}' found in geolife path '{}'. The geolife path can only contain folders" \
-                     " named with integers that represent the user id.".format(tail, user_folder_this)
+            errmsg = (
+                "Invalid user_id '{}' found in geolife path '{}'. The geolife path can only contain folders"
+                " named with integers that represent the user id.".format(tail, user_folder_this)
+            )
             raise ValueError(errmsg) from err
 
         print("start importing geolife user_id: ", user_id)
 
-        input_files = sorted(glob.glob(os.path.join(
-            user_folder_this, "Trajectory", "*.plt")))
+        input_files = sorted(glob.glob(os.path.join(user_folder_this, "Trajectory", "*.plt")))
         df_list_days = []
 
         # read every day of every user and concatenate input files
         for input_file_this in input_files:
-            data_this = pd.read_csv(input_file_this, skiprows=6, header=None,
-                                    names=['lat', 'lon', 'zeros', 'elevation',
-                                           'date days', 'date', 'time'])
+            data_this = pd.read_csv(
+                input_file_this,
+                skiprows=6,
+                header=None,
+                names=["lat", "lon", "zeros", "elevation", "date days", "date", "time"],
+            )
 
-            data_this['tracked_at'] = pd.to_datetime(data_this['date']
-                                                     + ' ' + data_this['time'], format="%Y-%m-%d %H:%M:%S", utc=True)
+            data_this["tracked_at"] = pd.to_datetime(
+                data_this["date"] + " " + data_this["time"], format="%Y-%m-%d %H:%M:%S", utc=True
+            )
 
-            data_this.drop(['zeros', 'date days', 'date', 'time'], axis=1,
-                           inplace=True)
-            data_this['user_id'] = user_id
-            data_this['elevation'] = data_this['elevation'] * FEET2METER
+            data_this.drop(["zeros", "date days", "date", "time"], axis=1, inplace=True)
+            data_this["user_id"] = user_id
+            data_this["elevation"] = data_this["elevation"] * FEET2METER
 
-            data_this['geom'] = list(zip(data_this['lon'], data_this['lat']))
-            data_this['geom'] = data_this['geom'].apply(Point)
+            data_this["geom"] = list(zip(data_this["lon"], data_this["lat"]))
+            data_this["geom"] = data_this["geom"].apply(Point)
 
             df_list_days.append(data_this)
 
@@ -149,13 +153,14 @@ def read_geolife(geolife_path):
     gdf = gpd.GeoDataFrame(df, geometry="geom", crs=CRS_WGS84)
     gdf["accuracy"] = np.nan
 
-    gdf.index.name = 'id'
+    gdf.index.name = "id"
 
     return gdf, label_dict
 
 
-def geolife_add_modes_to_triplegs(tpls_in, labels, ratio_threshold=0.5, max_triplegs=20,
-                                  max_duration_tripleg=7 * 24 * 60 * 60):
+def geolife_add_modes_to_triplegs(
+    tpls_in, labels, ratio_threshold=0.5, max_triplegs=20, max_duration_tripleg=7 * 24 * 60 * 60
+):
     """
     Add available mode labels to geolife data.
 
@@ -187,52 +192,54 @@ def geolife_add_modes_to_triplegs(tpls_in, labels, ratio_threshold=0.5, max_trip
     """
     tpls = tpls_in.copy()
     # temp time fields for nn query
-    tpls['started_at_s'] = (tpls['started_at'] - pd.Timestamp("1970-01-01", tz='utc')) // pd.Timedelta('1s')
-    tpls['finished_at_s'] = (tpls['finished_at'] - pd.Timestamp("1970-01-01", tz='utc')) // pd.Timedelta('1s')
-    all_users = tpls['user_id'].unique()
+    tpls["started_at_s"] = (tpls["started_at"] - pd.Timestamp("1970-01-01", tz="utc")) // pd.Timedelta("1s")
+    tpls["finished_at_s"] = (tpls["finished_at"] - pd.Timestamp("1970-01-01", tz="utc")) // pd.Timedelta("1s")
+    all_users = tpls["user_id"].unique()
     # tpls_id_mode_list is used to collect tripleg-mode matches. It will be filled with dictionaries with the
     # following keys: [id', 'label_id', 'mode']
     tpls_id_mode_list = list()
 
     for user_this in all_users:
-        tpls_this = tpls[tpls['user_id'] == user_this]
+        tpls_this = tpls[tpls["user_id"] == user_this]
         labels_this = labels[user_this]
         if labels_this.empty:
             continue
 
-        labels_this['started_at_s'] = (labels_this['started_at'] -
-                                       pd.Timestamp("1970-01-01", tz='utc')) // pd.Timedelta('1s')
-        labels_this['finished_at_s'] = (labels_this['finished_at'] -
-                                        pd.Timestamp("1970-01-01", tz='utc')) // pd.Timedelta('1s')
+        labels_this["started_at_s"] = (
+            labels_this["started_at"] - pd.Timestamp("1970-01-01", tz="utc")
+        ) // pd.Timedelta("1s")
+        labels_this["finished_at_s"] = (
+            labels_this["finished_at"] - pd.Timestamp("1970-01-01", tz="utc")
+        ) // pd.Timedelta("1s")
 
         # fit search tree on timestamps
         if tpls_this.shape[0] < max_triplegs:
             max_triplegs = tpls_this.shape[0]
-        nn = NearestNeighbors(n_neighbors=max_triplegs, metric='chebyshev')
-        nn.fit(tpls_this[['started_at_s', 'finished_at_s']])
+        nn = NearestNeighbors(n_neighbors=max_triplegs, metric="chebyshev")
+        nn.fit(tpls_this[["started_at_s", "finished_at_s"]])
 
         # find closest neighbours for timestamps in labels
-        distances, candidates = nn.kneighbors(labels_this[['started_at_s', 'finished_at_s']])
+        distances, candidates = nn.kneighbors(labels_this[["started_at_s", "finished_at_s"]])
 
         # filter anything above max_duration_tripleg (max distance start or end)
         pre_filter = distances > max_duration_tripleg
 
-        candidates = pd.DataFrame(candidates, dtype='Int64')
+        candidates = pd.DataFrame(candidates, dtype="Int64")
         candidates[pre_filter] = np.nan
-        candidates.dropna(how='all', inplace=True)
+        candidates.dropna(how="all", inplace=True)
 
         # collect the tripleg - mode matches in the
         tpls_id_mode_list.extend(_calc_overlap_for_candidates(candidates, tpls_this, labels_this, ratio_threshold))
 
     if len(tpls_id_mode_list) == 0:
-        tpls['mode'] = np.nan
+        tpls["mode"] = np.nan
     else:
-        tpls_id_mode = pd.DataFrame(tpls_id_mode_list).set_index('id')
+        tpls_id_mode = pd.DataFrame(tpls_id_mode_list).set_index("id")
         tpls = tpls.join(tpls_id_mode)
-        tpls = tpls.astype({'label_id': 'Int64'})
+        tpls = tpls.astype({"label_id": "Int64"})
 
     try:
-        tpls.drop(['started_at_s', 'finished_at_s'], axis=1, inplace=True)
+        tpls.drop(["started_at_s", "finished_at_s"], axis=1, inplace=True)
     except KeyError:
         pass
 
@@ -285,13 +292,17 @@ def _calc_overlap_for_candidates(candidates, tpls_this, labels_this, ratio_thres
                 continue
 
             potential_tripleg = tpls_this.iloc[tpls_pos, :]
-            ratio_this = calc_temp_overlap(potential_tripleg['started_at'], potential_tripleg['finished_at'],
-                                           potential_label['started_at'], potential_label['finished_at'])
+            ratio_this = calc_temp_overlap(
+                potential_tripleg["started_at"],
+                potential_tripleg["finished_at"],
+                potential_label["started_at"],
+                potential_label["finished_at"],
+            )
 
             if ratio_this >= ratio_threshold:
                 # assign label to tripleg (by storing matching in dictionary)
-                tpls_id_mode_list.append({'id': potential_tripleg.name,
-                                          'label_id': potential_label.name,
-                                          'mode': potential_label['mode']})
+                tpls_id_mode_list.append(
+                    {"id": potential_tripleg.name, "label_id": potential_label.name, "mode": potential_label["mode"]}
+                )
 
     return tpls_id_mode_list
diff --git a/trackintel/io/file.py b/trackintel/io/file.py
index 7ebc8e4e..36a288d4 100644
--- a/trackintel/io/file.py
+++ b/trackintel/io/file.py
@@ -58,28 +58,30 @@ def read_positionfixes_csv(*args, columns=None, tz=None, index_col=object(), crs
 
     # Warning if no 'index_col' parameter is provided
     if type(index_col) == object:
-        warnings.warn("Assuming default index as unique identifier. Pass 'index_col=None' as explicit" +
-                      "argument to avoid a warning when reading csv files.")
+        warnings.warn(
+            "Assuming default index as unique identifier. Pass 'index_col=None' as explicit"
+            + "argument to avoid a warning when reading csv files."
+        )
     elif index_col is not None:
-        kwargs['index_col'] = index_col
+        kwargs["index_col"] = index_col
 
     df = pd.read_csv(*args, **kwargs)
     df = df.rename(columns=columns)
-    
+
     # construct geom column from lon and lat
-    df['geom'] = list(zip(df['longitude'], df['latitude']))
-    df['geom'] = df['geom'].apply(Point)
-    
+    df["geom"] = list(zip(df["longitude"], df["latitude"]))
+    df["geom"] = df["geom"].apply(Point)
+
     # transform to datatime
     df["tracked_at"] = pd.to_datetime(df["tracked_at"])
 
     # set timezone if none is recognized
-    for col in ['tracked_at']:
+    for col in ["tracked_at"]:
         if not pd.api.types.is_datetime64tz_dtype(df[col]):
             df[col] = _localize_timestamp(dt_series=df[col], pytz_tzinfo=tz, col_name=col)
 
-    df = df.drop(['longitude', 'latitude'], axis=1)
-    pfs = gpd.GeoDataFrame(df, geometry='geom')
+    df = df.drop(["longitude", "latitude"], axis=1)
+    pfs = gpd.GeoDataFrame(df, geometry="geom")
     if crs:
         pfs.set_crs(crs, inplace=True)
     assert pfs.as_positionfixes
@@ -102,10 +104,10 @@ def write_positionfixes_csv(positionfixes, filename, *args, **kwargs):
         The file to write to.
     """
     gdf = positionfixes.copy()
-    gdf['longitude'] = positionfixes.geometry.apply(lambda p: p.coords[0][0])
-    gdf['latitude'] = positionfixes.geometry.apply(lambda p: p.coords[0][1])
+    gdf["longitude"] = positionfixes.geometry.apply(lambda p: p.coords[0][0])
+    gdf["latitude"] = positionfixes.geometry.apply(lambda p: p.coords[0][1])
     df = gdf.drop(gdf.geometry.name, axis=1)
-    
+
     df.to_csv(filename, index=True, *args, **kwargs)
 
 
@@ -148,27 +150,29 @@ def read_triplegs_csv(*args, columns=None, tz=None, index_col=object(), crs=None
 
     # Warning if no 'index_col' parameter is provided
     if type(index_col) == object:
-        warnings.warn("Assuming default index as unique identifier. Pass 'index_col=None' as explicit" +
-                      "argument to avoid a warning when reading csv files.")
+        warnings.warn(
+            "Assuming default index as unique identifier. Pass 'index_col=None' as explicit"
+            + "argument to avoid a warning when reading csv files."
+        )
     elif index_col is not None:
-        kwargs['index_col'] = index_col
+        kwargs["index_col"] = index_col
 
     df = pd.read_csv(*args, **kwargs)
     df = df.rename(columns=columns)
-    
+
     # construct geom column
-    df['geom'] = df['geom'].apply(wkt.loads)
-    
+    df["geom"] = df["geom"].apply(wkt.loads)
+
     # transform to datatime
-    df["started_at"] = pd.to_datetime(df['started_at'])
-    df["finished_at"] = pd.to_datetime(df['finished_at'])
+    df["started_at"] = pd.to_datetime(df["started_at"])
+    df["finished_at"] = pd.to_datetime(df["finished_at"])
 
     # set timezone if none is recognized
-    for col in ['started_at', 'finished_at']:
+    for col in ["started_at", "finished_at"]:
         if not pd.api.types.is_datetime64tz_dtype(df[col]):
             df[col] = _localize_timestamp(dt_series=df[col], pytz_tzinfo=tz, col_name=col)
-            
-    tpls = gpd.GeoDataFrame(df, geometry='geom')
+
+    tpls = gpd.GeoDataFrame(df, geometry="geom")
     if crs:
         tpls.set_crs(crs, inplace=True)
     assert tpls.as_triplegs
@@ -233,30 +237,32 @@ def read_staypoints_csv(*args, columns=None, tz=None, index_col=object(), crs=No
     >>> trackintel.read_staypoints_csv('data.csv', columns={'start_time':'started_at', 'User':'user_id'})
     """
     columns = {} if columns is None else columns
-    
+
     # Warning if no 'index_col' parameter is provided
     if type(index_col) == object:
-        warnings.warn("Assuming default index as unique identifier. Pass 'index_col=None' as explicit" +
-                      "argument to avoid a warning when reading csv files.")
+        warnings.warn(
+            "Assuming default index as unique identifier. Pass 'index_col=None' as explicit"
+            + "argument to avoid a warning when reading csv files."
+        )
     elif index_col is not None:
-        kwargs['index_col'] = index_col
+        kwargs["index_col"] = index_col
 
     df = pd.read_csv(*args, **kwargs)
     df = df.rename(columns=columns)
-    
+
     # construct geom column
-    df['geom'] = df['geom'].apply(wkt.loads)
-    
+    df["geom"] = df["geom"].apply(wkt.loads)
+
     # transform to datatime
-    df["started_at"] = pd.to_datetime(df['started_at'])
-    df["finished_at"] = pd.to_datetime(df['finished_at'])
+    df["started_at"] = pd.to_datetime(df["started_at"])
+    df["finished_at"] = pd.to_datetime(df["finished_at"])
 
     # set timezone if none is recognized
-    for col in ['started_at', 'finished_at']:
+    for col in ["started_at", "finished_at"]:
         if not pd.api.types.is_datetime64tz_dtype(df[col]):
             df[col] = _localize_timestamp(dt_series=df[col], pytz_tzinfo=tz, col_name=col)
-        
-    stps = gpd.GeoDataFrame(df, geometry='geom')
+
+    stps = gpd.GeoDataFrame(df, geometry="geom")
     if crs:
         stps.set_crs(crs, inplace=True)
     assert stps.as_staypoints
@@ -318,23 +324,25 @@ def read_locations_csv(*args, columns=None, index_col=object(), crs=None, **kwar
     >>> trackintel.read_locations_csv('data.csv', columns={'start_time':'started_at', 'User':'user_id'})
     """
     columns = {} if columns is None else columns
-    
+
     # Warning if no 'index_col' parameter is provided
     if type(index_col) == object:
-        warnings.warn("Assuming default index as unique identifier. Pass 'index_col=None' as explicit" +
-                      "argument to avoid a warning when reading csv files.")
+        warnings.warn(
+            "Assuming default index as unique identifier. Pass 'index_col=None' as explicit"
+            + "argument to avoid a warning when reading csv files."
+        )
     elif index_col is not None:
-        kwargs['index_col'] = index_col
-    
+        kwargs["index_col"] = index_col
+
     df = pd.read_csv(*args, **kwargs)
     df = df.rename(columns=columns)
-    
+
     # construct center and extent columns
-    df['center'] = df['center'].apply(wkt.loads)
-    if 'extent' in df.columns:
-        df['extent'] = df['extent'].apply(wkt.loads)
-        
-    locs = gpd.GeoDataFrame(df, geometry='center')
+    df["center"] = df["center"].apply(wkt.loads)
+    if "extent" in df.columns:
+        df["extent"] = df["extent"].apply(wkt.loads)
+
+    locs = gpd.GeoDataFrame(df, geometry="center")
     if crs:
         locs.set_crs(crs, inplace=True)
     assert locs.as_locations
@@ -357,9 +365,9 @@ def write_locations_csv(locations, filename, *args, **kwargs):
         The file to write to.
     """
     df = pd.DataFrame(locations, copy=True)
-    df['center'] = locations['center'].apply(wkt.dumps)
-    if 'extent' in df.columns:
-        df['extent'] = locations['extent'].apply(wkt.dumps)
+    df["center"] = locations["center"].apply(wkt.dumps)
+    if "extent" in df.columns:
+        df["extent"] = locations["extent"].apply(wkt.dumps)
     df.to_csv(filename, index=True, *args, **kwargs)
 
 
@@ -396,20 +404,22 @@ def read_trips_csv(*args, columns=None, tz=None, index_col=object(), **kwargs):
     columns = {} if columns is None else columns
 
     if type(index_col) == object:
-        warnings.warn("Assuming default index as unique identifier. Pass 'index_col=None' as explicit" +
-                      "argument to avoid a warning when reading csv files.")
+        warnings.warn(
+            "Assuming default index as unique identifier. Pass 'index_col=None' as explicit"
+            + "argument to avoid a warning when reading csv files."
+        )
     elif index_col is not None:
-        kwargs['index_col'] = index_col
-    
+        kwargs["index_col"] = index_col
+
     trips = pd.read_csv(*args, **kwargs)
     trips = trips.rename(columns=columns)
-    
+
     # transform to datatime
-    trips["started_at"] = pd.to_datetime(trips['started_at'])
-    trips["finished_at"] = pd.to_datetime(trips['finished_at'])
+    trips["started_at"] = pd.to_datetime(trips["started_at"])
+    trips["finished_at"] = pd.to_datetime(trips["finished_at"])
 
     # check and/or set timezone
-    for col in ['started_at', 'finished_at']:
+    for col in ["started_at", "finished_at"]:
         if not pd.api.types.is_datetime64tz_dtype(trips[col]):
             trips[col] = _localize_timestamp(dt_series=trips[col], pytz_tzinfo=tz, col_name=col)
 
@@ -509,7 +519,7 @@ def _localize_timestamp(dt_series, pytz_tzinfo, col_name):
     """
     if pytz_tzinfo is None:
         warnings.warn("Assuming UTC timezone for column {}".format(col_name))
-        pytz_tzinfo = 'utc'
+        pytz_tzinfo = "utc"
 
     timezone = pytz.timezone(pytz_tzinfo)
-    return dt_series.apply(pd.Timestamp, tz=timezone)
\ No newline at end of file
+    return dt_series.apply(pd.Timestamp, tz=timezone)
diff --git a/trackintel/io/from_geopandas.py b/trackintel/io/from_geopandas.py
index 0cda7ea3..8e28ba72 100644
--- a/trackintel/io/from_geopandas.py
+++ b/trackintel/io/from_geopandas.py
@@ -3,7 +3,7 @@
 from trackintel.io.file import _localize_timestamp
 
 
-def read_positionfixes_gpd(gdf, tracked_at='tracked_at', user_id='user_id', geom='geom', tz=None, mapper={}):
+def read_positionfixes_gpd(gdf, tracked_at="tracked_at", user_id="user_id", geom="geom", tz=None, mapper={}):
     """
     Read positionfixes from GeoDataFrames.
     
@@ -38,26 +38,24 @@ def read_positionfixes_gpd(gdf, tracked_at='tracked_at', user_id='user_id', geom
     --------
     >>> trackintel.read_positionfixes_gpd(gdf, user_id='User', geom='geometry', tz='utc')
     """
-    columns = {tracked_at: 'tracked_at',
-               user_id: 'user_id',
-               geom: 'geom'}
+    columns = {tracked_at: "tracked_at", user_id: "user_id", geom: "geom"}
     columns.update(mapper)
 
     pfs = gdf.rename(columns=columns)
-    pfs = pfs.set_geometry('geom')
+    pfs = pfs.set_geometry("geom")
 
     # check and/or set timezone
-    for col in ['tracked_at']:
+    for col in ["tracked_at"]:
         if not pd.api.types.is_datetime64tz_dtype(pfs[col]):
             pfs[col] = _localize_timestamp(dt_series=pfs[col], pytz_tzinfo=tz, col_name=col)
-        
+
     assert pfs.as_positionfixes
     return pfs
 
 
-def read_staypoints_gpd(gdf, started_at='started_at', finished_at='finished_at', user_id='user_id', geom='geom',
-                        tz=None,
-                        mapper={}):
+def read_staypoints_gpd(
+    gdf, started_at="started_at", finished_at="finished_at", user_id="user_id", geom="geom", tz=None, mapper={}
+):
     """
     Read staypoints from GeoDataFrames.
     
@@ -95,26 +93,24 @@ def read_staypoints_gpd(gdf, started_at='started_at', finished_at='finished_at',
     --------
     >>> trackintel.read_staypoints_gpd(gdf, started_at='start_time', finished_at='end_time', tz='utc')
     """
-    columns = {started_at: 'started_at',
-               finished_at: 'finished_at',
-               user_id: 'user_id',
-               geom: 'geom'}
+    columns = {started_at: "started_at", finished_at: "finished_at", user_id: "user_id", geom: "geom"}
     columns.update(mapper)
 
     stps = gdf.rename(columns=columns)
-    stps = stps.set_geometry('geom')
+    stps = stps.set_geometry("geom")
 
     # check and/or set timezone
-    for col in ['started_at', 'finished_at']:
+    for col in ["started_at", "finished_at"]:
         if not pd.api.types.is_datetime64tz_dtype(stps[col]):
             stps[col] = _localize_timestamp(dt_series=stps[col], pytz_tzinfo=tz, col_name=col)
-        
+
     assert stps.as_staypoints
     return stps
 
 
-def read_triplegs_gpd(gdf, started_at='started_at', finished_at='finished_at', user_id='user_id', geom='geometry',
-                      tz=None, mapper={}):
+def read_triplegs_gpd(
+    gdf, started_at="started_at", finished_at="finished_at", user_id="user_id", geom="geometry", tz=None, mapper={}
+):
     """
     Read triplegs from GeoDataFrames.
     
@@ -152,17 +148,14 @@ def read_triplegs_gpd(gdf, started_at='started_at', finished_at='finished_at', u
     --------
     >>> trackintel.read_triplegs_gpd(gdf, user_id='User', geom='geometry', tz='utc')
     """
-    columns = {started_at: 'started_at',
-               finished_at: 'finished_at',
-               user_id: 'user_id',
-               geom: 'geom'}
+    columns = {started_at: "started_at", finished_at: "finished_at", user_id: "user_id", geom: "geom"}
     columns.update(mapper)
 
     tpls = gdf.rename(columns=columns)
-    tpls = tpls.set_geometry('geom')
+    tpls = tpls.set_geometry("geom")
 
     # check and/or set timezone
-    for col in ['started_at', 'finished_at']:
+    for col in ["started_at", "finished_at"]:
         if not pd.api.types.is_datetime64tz_dtype(tpls[col]):
             tpls[col] = _localize_timestamp(dt_series=tpls[col], pytz_tzinfo=tz, col_name=col)
 
@@ -170,9 +163,16 @@ def read_triplegs_gpd(gdf, started_at='started_at', finished_at='finished_at', u
     return tpls
 
 
-def read_trips_gpd(gdf, started_at='started_at', finished_at='finished_at', user_id='user_id',
-                   origin_staypoint_id='origin_staypoint_id', destination_staypoint_id='destination_staypoint_id',
-                   tz=None, mapper={}):
+def read_trips_gpd(
+    gdf,
+    started_at="started_at",
+    finished_at="finished_at",
+    user_id="user_id",
+    origin_staypoint_id="origin_staypoint_id",
+    destination_staypoint_id="destination_staypoint_id",
+    tz=None,
+    mapper={},
+):
     """
     Read trips from GeoDataFrames/DataFrames.
     
@@ -213,18 +213,19 @@ def read_trips_gpd(gdf, started_at='started_at', finished_at='finished_at', user
     --------
     >>> trackintel.read_trips_gpd(df, tz='utc')
     """
-    columns = {started_at: 'started_at',
-               finished_at: 'finished_at',
-               user_id: 'user_id',
-               origin_staypoint_id: 'origin_staypoint_id',
-               destination_staypoint_id: 'destination_staypoint_id'
-               }
+    columns = {
+        started_at: "started_at",
+        finished_at: "finished_at",
+        user_id: "user_id",
+        origin_staypoint_id: "origin_staypoint_id",
+        destination_staypoint_id: "destination_staypoint_id",
+    }
     columns.update(mapper)
 
     trips = gdf.rename(columns=columns)
 
     # check and/or set timezone
-    for col in ['started_at', 'finished_at']:
+    for col in ["started_at", "finished_at"]:
         if not pd.api.types.is_datetime64tz_dtype(trips[col]):
             trips[col] = _localize_timestamp(dt_series=trips[col], pytz_tzinfo=tz, col_name=col)
 
@@ -232,7 +233,7 @@ def read_trips_gpd(gdf, started_at='started_at', finished_at='finished_at', user
     return trips
 
 
-def read_locations_gpd(gdf, user_id='user_id', center='center', mapper={}):
+def read_locations_gpd(gdf, user_id="user_id", center="center", mapper={}):
     """
     Read locations from GeoDataFrames.
     
@@ -264,20 +265,26 @@ def read_locations_gpd(gdf, user_id='user_id', center='center', mapper={}):
     --------
     >>> trackintel.read_locations_gpd(df, user_id='User', center='geometry')
     """
-    columns = {user_id: 'user_id',
-               center: 'center'}
+    columns = {user_id: "user_id", center: "center"}
     columns.update(mapper)
 
     locs = gdf.rename(columns=columns)
-    locs = locs.set_geometry('center')
+    locs = locs.set_geometry("center")
 
     assert locs.as_locations
     return locs
 
 
-def read_tours_gpd(gdf, user_id='user_id', started_at='started_at', finished_at='finished_at',
-                   origin_destination_location_id='origin_destination_location_id', journey='journey',
-                   tz=None, mapper={}):
+def read_tours_gpd(
+    gdf,
+    user_id="user_id",
+    started_at="started_at",
+    finished_at="finished_at",
+    origin_destination_location_id="origin_destination_location_id",
+    journey="journey",
+    tz=None,
+    mapper={},
+):
     """
     Read tours from GeoDataFrames.
     
diff --git a/trackintel/io/postgis.py b/trackintel/io/postgis.py
index ea4d54a8..df61ad57 100644
--- a/trackintel/io/postgis.py
+++ b/trackintel/io/postgis.py
@@ -4,7 +4,7 @@
 from sqlalchemy import create_engine
 
 
-def read_positionfixes_postgis(conn_string, table_name, geom_col='geom', *args, **kwargs):
+def read_positionfixes_postgis(conn_string, table_name, geom_col="geom", *args, **kwargs):
     """Reads positionfixes from a PostGIS database.
 
     Parameters
@@ -33,17 +33,16 @@ def read_positionfixes_postgis(conn_string, table_name, geom_col='geom', *args,
     engine = create_engine(conn_string)
     conn = engine.connect()
     try:
-        pfs = gpd.GeoDataFrame.from_postgis("SELECT * FROM %s" % table_name, conn, 
-                                            geom_col=geom_col,
-                                            *args, **kwargs)
+        pfs = gpd.GeoDataFrame.from_postgis("SELECT * FROM %s" % table_name, conn, geom_col=geom_col, *args, **kwargs)
     finally:
         conn.close()
     assert pfs.as_positionfixes
     return pfs
 
 
-def write_positionfixes_postgis(positionfixes, conn_string, table_name, schema=None,
-                                sql_chunksize=None, if_exists='replace'):
+def write_positionfixes_postgis(
+    positionfixes, conn_string, table_name, schema=None, sql_chunksize=None, if_exists="replace"
+):
     """Stores positionfixes to PostGIS. Usually, this is directly called on a positionfixes 
     DataFrame (see example below).
 
@@ -74,32 +73,36 @@ def write_positionfixes_postgis(positionfixes, conn_string, table_name, schema=N
     --------
     >>> df.as_positionfixes.to_postgis(conn_string, table_name)
     """
-    
+
     # make a copy in order to avoid changing the geometry of the original array
     positionfixes_postgis = positionfixes.copy()
 
     # If this GeoDataFrame already has an SRID, we use it, otherwise we default to WGS84.
-    if (positionfixes_postgis.crs is not None):
+    if positionfixes_postgis.crs is not None:
         srid = int(positionfixes_postgis.crs.to_epsg())
     else:
         srid = 4326
-    positionfixes_postgis['geom'] = \
-    positionfixes_postgis['geom'].apply(lambda x: WKTElement(x.wkt, srid=srid))
-    if 'id' not in positionfixes_postgis.columns:
-        positionfixes_postgis['id'] = positionfixes_postgis.index
+    positionfixes_postgis["geom"] = positionfixes_postgis["geom"].apply(lambda x: WKTElement(x.wkt, srid=srid))
+    if "id" not in positionfixes_postgis.columns:
+        positionfixes_postgis["id"] = positionfixes_postgis.index
 
     engine = create_engine(conn_string)
     conn = engine.connect()
     try:
-        positionfixes_postgis.to_sql(table_name, engine, schema=schema,
-                                     if_exists=if_exists, index=False,  
-                                     dtype={'geom': Geometry('POINT', srid=srid)},
-                                     chunksize=sql_chunksize)
+        positionfixes_postgis.to_sql(
+            table_name,
+            engine,
+            schema=schema,
+            if_exists=if_exists,
+            index=False,
+            dtype={"geom": Geometry("POINT", srid=srid)},
+            chunksize=sql_chunksize,
+        )
     finally:
         conn.close()
 
 
-def read_triplegs_postgis(conn_string, table_name, geom_col='geom', *args, **kwargs):
+def read_triplegs_postgis(conn_string, table_name, geom_col="geom", *args, **kwargs):
     """Reads triplegs from a PostGIS database.
 
     Parameters
@@ -122,17 +125,16 @@ def read_triplegs_postgis(conn_string, table_name, geom_col='geom', *args, **kwa
     engine = create_engine(conn_string)
     conn = engine.connect()
     try:
-        pfs = gpd.GeoDataFrame.from_postgis("SELECT * FROM %s" % table_name, conn, 
-                                            geom_col=geom_col, index_col='id',
-                                            *args, **kwargs)
+        pfs = gpd.GeoDataFrame.from_postgis(
+            "SELECT * FROM %s" % table_name, conn, geom_col=geom_col, index_col="id", *args, **kwargs
+        )
     finally:
         conn.close()
     assert pfs.as_triplegs
     return pfs
 
 
-def write_triplegs_postgis(triplegs, conn_string, table_name, schema=None,
-                           sql_chunksize=None, if_exists='replace'):
+def write_triplegs_postgis(triplegs, conn_string, table_name, schema=None, sql_chunksize=None, if_exists="replace"):
     """Stores triplegs to PostGIS. Usually, this is directly called on a triplegs 
     DataFrame (see example below).
 
@@ -163,28 +165,32 @@ def write_triplegs_postgis(triplegs, conn_string, table_name, schema=None,
     --------
     >>> df.as_triplegs.to_postgis(conn_string, table_name)
     """
-    
+
     # make a copy in order to avoid changing the geometry of the original array
     triplegs_postgis = triplegs.copy()
-    
+
     srid = int(triplegs_postgis.crs.to_epsg())
-    triplegs_postgis['geom'] = \
-        triplegs_postgis['geom'].apply(lambda x: WKTElement(x.wkt, srid=srid))
-    if 'id' not in triplegs_postgis.columns:
-        triplegs_postgis['id'] = triplegs_postgis.index
+    triplegs_postgis["geom"] = triplegs_postgis["geom"].apply(lambda x: WKTElement(x.wkt, srid=srid))
+    if "id" not in triplegs_postgis.columns:
+        triplegs_postgis["id"] = triplegs_postgis.index
 
     engine = create_engine(conn_string)
     conn = engine.connect()
     try:
-        triplegs_postgis.to_sql(table_name, engine, schema=schema,
-                                if_exists=if_exists, index=False, 
-                                dtype={'geom': Geometry('LINESTRING', srid=srid)},
-                                chunksize=sql_chunksize)
+        triplegs_postgis.to_sql(
+            table_name,
+            engine,
+            schema=schema,
+            if_exists=if_exists,
+            index=False,
+            dtype={"geom": Geometry("LINESTRING", srid=srid)},
+            chunksize=sql_chunksize,
+        )
     finally:
         conn.close()
 
 
-def read_staypoints_postgis(conn_string, table_name, geom_col='geom', *args, **kwargs):
+def read_staypoints_postgis(conn_string, table_name, geom_col="geom", *args, **kwargs):
     """Reads staypoints from a PostGIS database.
 
     Parameters
@@ -207,17 +213,16 @@ def read_staypoints_postgis(conn_string, table_name, geom_col='geom', *args, **k
     engine = create_engine(conn_string)
     conn = engine.connect()
     try:
-        pfs = gpd.GeoDataFrame.from_postgis("SELECT * FROM %s" % table_name, conn, 
-                                            geom_col=geom_col, index_col='id',
-                                            *args, **kwargs)
+        pfs = gpd.GeoDataFrame.from_postgis(
+            "SELECT * FROM %s" % table_name, conn, geom_col=geom_col, index_col="id", *args, **kwargs
+        )
     finally:
         conn.close()
     assert pfs.as_staypoints
     return pfs
 
 
-def write_staypoints_postgis(staypoints, conn_string, table_name, schema=None,
-                             sql_chunksize=None, if_exists='replace'):
+def write_staypoints_postgis(staypoints, conn_string, table_name, schema=None, sql_chunksize=None, if_exists="replace"):
     """Stores staypoints to PostGIS. Usually, this is directly called on a staypoints 
     DataFrame (see example below).
 
@@ -248,33 +253,37 @@ def write_staypoints_postgis(staypoints, conn_string, table_name, schema=None,
     --------
     >>> df.as_staypoints.to_postgis(conn_string, table_name)
     """
-    
-    # todo: Think about a conecpt for the indices. At the moment, an index 
-    # column is required when downloading. This means, that the ID column is 
+
+    # todo: Think about a conecpt for the indices. At the moment, an index
+    # column is required when downloading. This means, that the ID column is
     # taken as pandas index. When uploading the default is "no index" and
     # thereby the index column is lost
-    
+
     # make a copy in order to avoid changing the geometry of the original array
     staypoints_postgis = staypoints.copy()
-    
+
     srid = int(staypoints_postgis.crs.to_epsg())
-    staypoints_postgis['geom'] = \
-        staypoints_postgis['geom'].apply(lambda x: WKTElement(x.wkt, srid=srid))
-    if 'id' not in staypoints_postgis.columns:
-        staypoints_postgis['id'] = staypoints_postgis.index
+    staypoints_postgis["geom"] = staypoints_postgis["geom"].apply(lambda x: WKTElement(x.wkt, srid=srid))
+    if "id" not in staypoints_postgis.columns:
+        staypoints_postgis["id"] = staypoints_postgis.index
 
     engine = create_engine(conn_string)
     conn = engine.connect()
     try:
-        staypoints_postgis.to_sql(table_name, engine, schema=schema,
-                                  if_exists=if_exists, index=False, 
-                                  dtype={'geom': Geometry('POINT', srid=srid)},
-                                  chunksize=sql_chunksize)
+        staypoints_postgis.to_sql(
+            table_name,
+            engine,
+            schema=schema,
+            if_exists=if_exists,
+            index=False,
+            dtype={"geom": Geometry("POINT", srid=srid)},
+            chunksize=sql_chunksize,
+        )
     finally:
         conn.close()
-        
-        
-def read_locations_postgis(conn_string, table_name, geom_col='geom', *args, **kwargs):
+
+
+def read_locations_postgis(conn_string, table_name, geom_col="geom", *args, **kwargs):
     """Reads locations from a PostGIS database.
 
     Parameters
@@ -297,17 +306,16 @@ def read_locations_postgis(conn_string, table_name, geom_col='geom', *args, **kw
     engine = create_engine(conn_string)
     conn = engine.connect()
     try:
-        locs = gpd.GeoDataFrame.from_postgis("SELECT * FROM %s" % table_name, conn, 
-                                            geom_col=geom_col, index_col='id',
-                                            *args, **kwargs)
+        locs = gpd.GeoDataFrame.from_postgis(
+            "SELECT * FROM %s" % table_name, conn, geom_col=geom_col, index_col="id", *args, **kwargs
+        )
     finally:
         conn.close()
     assert locs.as_locations
     return locs
 
 
-def write_locations_postgis(locations, conn_string, table_name, schema=None,
-                         sql_chunksize=None, if_exists='replace'):
+def write_locations_postgis(locations, conn_string, table_name, schema=None, sql_chunksize=None, if_exists="replace"):
     """Stores locations to PostGIS. Usually, this is directly called on a locations 
     GeoDataFrame (see example below).
 
@@ -338,30 +346,32 @@ def write_locations_postgis(locations, conn_string, table_name, schema=None,
     --------
     >>> df.as_locations.to_postgis(conn_string, table_name)
     """
-    
+
     # make a copy in order to avoid changing the geometry of the original array
     locations_postgis = locations.copy()
-    
-    srid = int(locations_postgis.crs['init'].split(':')[1])
-    locations_postgis['center'] = \
-        locations_postgis['center'].apply(lambda x: WKTElement(x.wkt, srid=srid))
-    locations_postgis['extent'] = \
-        locations_postgis['extent'].apply(lambda x: WKTElement(x.wkt, srid=srid))
-    if 'id' not in locations_postgis.columns:
-        locations_postgis['id'] = locations_postgis.index
+
+    srid = int(locations_postgis.crs["init"].split(":")[1])
+    locations_postgis["center"] = locations_postgis["center"].apply(lambda x: WKTElement(x.wkt, srid=srid))
+    locations_postgis["extent"] = locations_postgis["extent"].apply(lambda x: WKTElement(x.wkt, srid=srid))
+    if "id" not in locations_postgis.columns:
+        locations_postgis["id"] = locations_postgis.index
 
     engine = create_engine(conn_string)
     conn = engine.connect()
     try:
-        locations_postgis.to_sql(table_name, engine, schema=schema,
-                              if_exists=if_exists, index=False, 
-                              dtype={'center': Geometry('POINT', srid=srid),
-                                     'extent': Geometry('GEOMETRY', srid=srid)},
-                              chunksize=sql_chunksize)
+        locations_postgis.to_sql(
+            table_name,
+            engine,
+            schema=schema,
+            if_exists=if_exists,
+            index=False,
+            dtype={"center": Geometry("POINT", srid=srid), "extent": Geometry("GEOMETRY", srid=srid)},
+            chunksize=sql_chunksize,
+        )
     finally:
         conn.close()
 
-        
+
 def read_trips_postgis(conn_string, table_name, *args, **kwargs):
     """Reads trips from a PostGIS database.
 
@@ -382,16 +392,14 @@ def read_trips_postgis(conn_string, table_name, *args, **kwargs):
     engine = create_engine(conn_string)
     conn = engine.connect()
     try:
-        trps = pd.read_sql("SELECT * FROM %s" % table_name, conn, index_col='id',
-                           *args, **kwargs)
+        trps = pd.read_sql("SELECT * FROM %s" % table_name, conn, index_col="id", *args, **kwargs)
     finally:
         conn.close()
     assert trps.as_trips
     return trps
 
 
-def write_trips_postgis(trips, conn_string, table_name, schema=None,
-                         sql_chunksize=None, if_exists='replace'):
+def write_trips_postgis(trips, conn_string, table_name, schema=None, sql_chunksize=None, if_exists="replace"):
     """Stores trips to PostGIS. Usually, this is directly called on a trips 
     DataFrame (see example below).
 
@@ -422,25 +430,27 @@ def write_trips_postgis(trips, conn_string, table_name, schema=None,
     --------
     >>> df.as_trips.to_postgis(conn_string, table_name)
     """
-    
+
     # make a copy in order to avoid changing the geometry of the original array
     trips_postgis = trips.copy()
-    
+
     srid = int(trips_postgis.crs.to_epsg())
-    trips_postgis['center'] = \
-        trips_postgis['center'].apply(lambda x: WKTElement(x.wkt, srid=srid))
-    trips_postgis['extent'] = \
-        trips_postgis['extent'].apply(lambda x: WKTElement(x.wkt, srid=srid))
-    if 'id' not in trips_postgis.columns:
-        trips_postgis['id'] = trips_postgis.index
+    trips_postgis["center"] = trips_postgis["center"].apply(lambda x: WKTElement(x.wkt, srid=srid))
+    trips_postgis["extent"] = trips_postgis["extent"].apply(lambda x: WKTElement(x.wkt, srid=srid))
+    if "id" not in trips_postgis.columns:
+        trips_postgis["id"] = trips_postgis.index
 
     engine = create_engine(conn_string)
     conn = engine.connect()
     try:
-        trips_postgis.to_sql(table_name, engine, schema=schema,
-                              if_exists=if_exists, index=False, 
-                        dtype={'center': Geometry('POINT', srid=srid),
-                               'extent': Geometry('GEOMETRY', srid=srid)},
-                               chunksize=sql_chunksize)
+        trips_postgis.to_sql(
+            table_name,
+            engine,
+            schema=schema,
+            if_exists=if_exists,
+            index=False,
+            dtype={"center": Geometry("POINT", srid=srid), "extent": Geometry("GEOMETRY", srid=srid)},
+            chunksize=sql_chunksize,
+        )
     finally:
         conn.close()
diff --git a/trackintel/model/__init__.py b/trackintel/model/__init__.py
index d3373b9f..f94f55f8 100644
--- a/trackintel/model/__init__.py
+++ b/trackintel/model/__init__.py
@@ -4,4 +4,4 @@
 from .locations import LocationsAccessor
 from .trips import TripsAccessor
 from .users import UsersAccessor
-from .tours import ToursAccessor
\ No newline at end of file
+from .tours import ToursAccessor
diff --git a/trackintel/model/locations.py b/trackintel/model/locations.py
index 9f6f13c0..c1529384 100644
--- a/trackintel/model/locations.py
+++ b/trackintel/model/locations.py
@@ -28,7 +28,7 @@ class LocationsAccessor(object):
     >>> df.as_locations.plot()
     """
 
-    required_columns = ['user_id', 'center']
+    required_columns = ["user_id", "center"]
 
     def __init__(self, pandas_obj):
         self._validate(pandas_obj)
@@ -37,11 +37,13 @@ def __init__(self, pandas_obj):
     @staticmethod
     def _validate(obj):
         if any([c not in obj.columns for c in LocationsAccessor.required_columns]):
-            raise AttributeError("To process a DataFrame as a collection of locations, " \
-                + "it must have the properties [%s], but it has [%s]." \
-                % (', '.join(LocationsAccessor.required_columns), ', '.join(obj.columns)))
+            raise AttributeError(
+                "To process a DataFrame as a collection of locations, "
+                + "it must have the properties [%s], but it has [%s]."
+                % (", ".join(LocationsAccessor.required_columns), ", ".join(obj.columns))
+            )
 
-        if not (obj.shape[0] > 0 and obj['center'].iloc[0].geom_type == 'Point'):
+        if not (obj.shape[0] > 0 and obj["center"].iloc[0].geom_type == "Point"):
             # todo: We could think about allowing both geometry types for locations (point and polygon)
             # One for extend and one for the center
             raise AttributeError("The center geometry must be a Point (only first checked).")
@@ -62,20 +64,18 @@ def to_csv(self, filename, *args, **kwargs):
         """
         ti.io.file.write_locations_csv(self._obj, filename, *args, **kwargs)
 
-    def to_postgis(self, conn_string, table_name, schema=None,
-            sql_chunksize=None, if_exists='replace'):
+    def to_postgis(self, conn_string, table_name, schema=None, sql_chunksize=None, if_exists="replace"):
         """
         Store this collection of locations to PostGIS.
         
         See :func:`trackintel.io.postgis.write_locations_postgis`.
         """
-        ti.io.postgis.write_locations_postgis(self._obj, conn_string, table_name, 
-            schema, sql_chunksize, if_exists)
-        
+        ti.io.postgis.write_locations_postgis(self._obj, conn_string, table_name, schema, sql_chunksize, if_exists)
+
     def spatial_filter(self, *args, **kwargs):
         """
         Filter locations with a geo extent.
         
         See :func:`trackintel.preprocessing.filter.spatial_filter`.
         """
-        return ti.preprocessing.filter.spatial_filter(self._obj, *args, **kwargs)
\ No newline at end of file
+        return ti.preprocessing.filter.spatial_filter(self._obj, *args, **kwargs)
diff --git a/trackintel/model/positionfixes.py b/trackintel/model/positionfixes.py
index a892fa49..f2d39731 100644
--- a/trackintel/model/positionfixes.py
+++ b/trackintel/model/positionfixes.py
@@ -30,8 +30,8 @@ class PositionfixesAccessor(object):
     --------
     >>> df.as_positionfixes.generate_staypoints()
     """
-    
-    required_columns = ['user_id', 'tracked_at']
+
+    required_columns = ["user_id", "tracked_at"]
 
     def __init__(self, pandas_obj):
         self._validate(pandas_obj)
@@ -42,20 +42,24 @@ def _validate(obj):
         assert obj.shape[0] > 0, "Geodataframe is empty with shape: {}".format(obj.shape)
         # check columns
         if any([c not in obj.columns for c in PositionfixesAccessor.required_columns]):
-            raise AttributeError("To process a DataFrame as a collection of positionfixes, " \
-                                 + "it must have the properties [%s], but it has [%s]." \
-                                 % (', '.join(PositionfixesAccessor.required_columns), ', '.join(obj.columns)))
+            raise AttributeError(
+                "To process a DataFrame as a collection of positionfixes, "
+                + "it must have the properties [%s], but it has [%s]."
+                % (", ".join(PositionfixesAccessor.required_columns), ", ".join(obj.columns))
+            )
 
         # check geometry
-        assert obj.geometry.is_valid.all(), "Not all geometries are valid. Try x[~ x.geometry.is_valid] " \
-                                            "where x is you GeoDataFrame"
+        assert obj.geometry.is_valid.all(), (
+            "Not all geometries are valid. Try x[~ x.geometry.is_valid] " "where x is you GeoDataFrame"
+        )
 
-        if obj.geometry.iloc[0].geom_type != 'Point':
+        if obj.geometry.iloc[0].geom_type != "Point":
             raise AttributeError("The geometry must be a Point (only first checked).")
 
         # check timestamp dtypes
-        assert pd.api.types.is_datetime64tz_dtype(obj['tracked_at']), \
-            "dtype of tracked_at is {} but has to be datetime64 and timezone aware".format(obj['tracked_at'].dtype)
+        assert pd.api.types.is_datetime64tz_dtype(
+            obj["tracked_at"]
+        ), "dtype of tracked_at is {} but has to be datetime64 and timezone aware".format(obj["tracked_at"].dtype)
 
     @property
     def center(self):
@@ -79,7 +83,7 @@ def generate_triplegs(self, stps_input=None, *args, **kwargs):
         See :func:`trackintel.preprocessing.positionfixes.generate_triplegs`.
         """
         return ti.preprocessing.positionfixes.generate_triplegs(self._obj, stps_input, *args, **kwargs)
-    
+
     def plot(self, *args, **kwargs):
         """
         Plot this collection of positionfixes.
@@ -96,15 +100,13 @@ def to_csv(self, filename, *args, **kwargs):
         """
         ti.io.file.write_positionfixes_csv(self._obj, filename, *args, **kwargs)
 
-    def to_postgis(self, conn_string, table_name, schema=None,
-                   sql_chunksize=None, if_exists='replace'):
+    def to_postgis(self, conn_string, table_name, schema=None, sql_chunksize=None, if_exists="replace"):
         """
         Store this collection of positionfixes to PostGIS.
         
         See :func:`trackintel.io.postgis.write_positionfixes_postgis`.
         """
-        ti.io.postgis.write_positionfixes_postgis(self._obj, conn_string, table_name,
-                                                  schema, sql_chunksize, if_exists)
+        ti.io.postgis.write_positionfixes_postgis(self._obj, conn_string, table_name, schema, sql_chunksize, if_exists)
 
     def calculate_distance_matrix(self, *args, **kwargs):
         """
diff --git a/trackintel/model/staypoints.py b/trackintel/model/staypoints.py
index 0141860c..400d9f09 100644
--- a/trackintel/model/staypoints.py
+++ b/trackintel/model/staypoints.py
@@ -34,7 +34,7 @@ class StaypointsAccessor(object):
     >>> df.as_staypoints.generate_locations()
     """
 
-    required_columns = ['user_id', 'started_at', 'finished_at']
+    required_columns = ["user_id", "started_at", "finished_at"]
 
     def __init__(self, pandas_obj):
         self._validate(pandas_obj)
@@ -44,20 +44,25 @@ def __init__(self, pandas_obj):
     def _validate(obj):
         # check columns
         if any([c not in obj.columns for c in StaypointsAccessor.required_columns]):
-            raise AttributeError("To process a DataFrame as a collection of staypoints, " \
-                                 + "it must have the properties [%s], but it has [%s]." \
-                                 % (', '.join(StaypointsAccessor.required_columns), ', '.join(obj.columns)))
+            raise AttributeError(
+                "To process a DataFrame as a collection of staypoints, "
+                + "it must have the properties [%s], but it has [%s]."
+                % (", ".join(StaypointsAccessor.required_columns), ", ".join(obj.columns))
+            )
         # check geometry
-        assert obj.geometry.is_valid.all(), "Not all geometries are valid. Try x[~ x.geometry.is_valid] " \
-                                            "where x is you GeoDataFrame"
-        if obj.geometry.iloc[0].geom_type != 'Point':
+        assert obj.geometry.is_valid.all(), (
+            "Not all geometries are valid. Try x[~ x.geometry.is_valid] " "where x is you GeoDataFrame"
+        )
+        if obj.geometry.iloc[0].geom_type != "Point":
             raise AttributeError("The geometry must be a Point (only first checked).")
-        
+
         # check timestamp dtypes
-        assert pd.api.types.is_datetime64tz_dtype(obj['started_at']), \
-            "dtype of started_at is {} but has to be tz aware datetime64".format(obj['started_at'].dtype)
-        assert pd.api.types.is_datetime64tz_dtype(obj['finished_at']), \
-            "dtype of finished_at is {} but has to be tz aware datetime64".format(obj['finished_at'].dtype)
+        assert pd.api.types.is_datetime64tz_dtype(
+            obj["started_at"]
+        ), "dtype of started_at is {} but has to be tz aware datetime64".format(obj["started_at"].dtype)
+        assert pd.api.types.is_datetime64tz_dtype(
+            obj["finished_at"]
+        ), "dtype of finished_at is {} but has to be tz aware datetime64".format(obj["finished_at"].dtype)
 
     @property
     def center(self):
diff --git a/trackintel/model/tours.py b/trackintel/model/tours.py
index 558b1e07..19395ee5 100644
--- a/trackintel/model/tours.py
+++ b/trackintel/model/tours.py
@@ -25,7 +25,7 @@ class ToursAccessor(object):
     >>> df.as_tours.plot()
     """
 
-    required_columns = ['user_id', 'started_at', 'finished_at', 'origin_destination_location_id', 'journey']
+    required_columns = ["user_id", "started_at", "finished_at", "origin_destination_location_id", "journey"]
 
     def __init__(self, pandas_obj):
         self._validate(pandas_obj)
@@ -34,15 +34,19 @@ def __init__(self, pandas_obj):
     @staticmethod
     def _validate(obj):
         if any([c not in obj.columns for c in ToursAccessor.required_columns]):
-            raise AttributeError("To process a DataFrame as a collection of tours, "
-                                 + "it must have the properties [%s], but it has [%s]."
-                                 % (', '.join(ToursAccessor.required_columns), ', '.join(obj.columns)))
+            raise AttributeError(
+                "To process a DataFrame as a collection of tours, "
+                + "it must have the properties [%s], but it has [%s]."
+                % (", ".join(ToursAccessor.required_columns), ", ".join(obj.columns))
+            )
 
         # check timestamp dtypes
-        assert pd.api.types.is_datetime64tz_dtype(obj['started_at']), \
-            "dtype of started_at is {} but has to be datetime64 and timezone aware".format(obj['started_at'].dtype)
-        assert pd.api.types.is_datetime64tz_dtype(obj['finished_at']), \
-            "dtype of finished_at is {} but has to be datetime64 and timezone aware".format(obj['finished_at'].dtype)
+        assert pd.api.types.is_datetime64tz_dtype(
+            obj["started_at"]
+        ), "dtype of started_at is {} but has to be datetime64 and timezone aware".format(obj["started_at"].dtype)
+        assert pd.api.types.is_datetime64tz_dtype(
+            obj["finished_at"]
+        ), "dtype of finished_at is {} but has to be datetime64 and timezone aware".format(obj["finished_at"].dtype)
 
     def to_csv(self, filename, *args, **kwargs):
         """
diff --git a/trackintel/model/triplegs.py b/trackintel/model/triplegs.py
index fb4e7714..3d4f6975 100644
--- a/trackintel/model/triplegs.py
+++ b/trackintel/model/triplegs.py
@@ -32,7 +32,7 @@ class TriplegsAccessor(object):
     >>> df.as_triplegs.plot()
     """
 
-    required_columns = ['user_id', 'started_at', 'finished_at']
+    required_columns = ["user_id", "started_at", "finished_at"]
 
     def __init__(self, pandas_obj):
         self._validate(pandas_obj)
@@ -43,20 +43,25 @@ def _validate(obj):
         assert obj.shape[0] > 0, "Geodataframe is empty with shape: {}".format(obj.shape)
         # check columns
         if any([c not in obj.columns for c in TriplegsAccessor.required_columns]):
-            raise AttributeError("To process a DataFrame as a collection of triplegs, " \
-                                 + "it must have the properties [%s], but it has [%s]." \
-                                 % (', '.join(TriplegsAccessor.required_columns), ', '.join(obj.columns)))
+            raise AttributeError(
+                "To process a DataFrame as a collection of triplegs, "
+                + "it must have the properties [%s], but it has [%s]."
+                % (", ".join(TriplegsAccessor.required_columns), ", ".join(obj.columns))
+            )
         # check geometry
-        assert obj.geometry.is_valid.all(), "Not all geometries are valid. Try x[~ x.geometry.is_valid] " \
-                                            "where x is you GeoDataFrame"
-        if obj.geometry.iloc[0].geom_type != 'LineString':
+        assert obj.geometry.is_valid.all(), (
+            "Not all geometries are valid. Try x[~ x.geometry.is_valid] " "where x is you GeoDataFrame"
+        )
+        if obj.geometry.iloc[0].geom_type != "LineString":
             raise AttributeError("The geometry must be a LineString (only first checked).")
 
         # check timestamp dtypes
-        assert pd.api.types.is_datetime64tz_dtype(obj['started_at']), \
-            "dtype of started_at is {} but has to be datetime64 and timezone aware".format(obj['started_at'].dtype)
-        assert pd.api.types.is_datetime64tz_dtype(obj['finished_at']), \
-            "dtype of finished_at is {} but has to be datetime64 and timezone aware".format(obj['finished_at'].dtype)
+        assert pd.api.types.is_datetime64tz_dtype(
+            obj["started_at"]
+        ), "dtype of started_at is {} but has to be datetime64 and timezone aware".format(obj["started_at"].dtype)
+        assert pd.api.types.is_datetime64tz_dtype(
+            obj["finished_at"]
+        ), "dtype of finished_at is {} but has to be datetime64 and timezone aware".format(obj["finished_at"].dtype)
 
     def plot(self, *args, **kwargs):
         """
diff --git a/trackintel/model/trips.py b/trackintel/model/trips.py
index 62d9bd9c..c6490906 100644
--- a/trackintel/model/trips.py
+++ b/trackintel/model/trips.py
@@ -38,7 +38,7 @@ class TripsAccessor(object):
     >>> df.as_trips.plot()
     """
 
-    required_columns = ['user_id', 'started_at', 'finished_at', 'origin_staypoint_id', 'destination_staypoint_id']
+    required_columns = ["user_id", "started_at", "finished_at", "origin_staypoint_id", "destination_staypoint_id"]
 
     def __init__(self, pandas_obj):
         self._validate(pandas_obj)
@@ -47,15 +47,19 @@ def __init__(self, pandas_obj):
     @staticmethod
     def _validate(obj):
         if any([c not in obj.columns for c in TripsAccessor.required_columns]):
-            raise AttributeError("To process a DataFrame as a collection of trips, "
-                                 + "it must have the properties [%s], but it has [%s]."
-                                 % (', '.join(TripsAccessor.required_columns), ', '.join(obj.columns)))
+            raise AttributeError(
+                "To process a DataFrame as a collection of trips, "
+                + "it must have the properties [%s], but it has [%s]."
+                % (", ".join(TripsAccessor.required_columns), ", ".join(obj.columns))
+            )
 
         # check timestamp dtypes
-        assert pd.api.types.is_datetime64tz_dtype(obj['started_at']), \
-            "dtype of started_at is {} but has to be datetime64 and timezone aware".format(obj['started_at'].dtype)
-        assert pd.api.types.is_datetime64tz_dtype(obj['finished_at']), \
-            "dtype of finished_at is {} but has to be datetime64 and timezone aware".format(obj['finished_at'].dtype)
+        assert pd.api.types.is_datetime64tz_dtype(
+            obj["started_at"]
+        ), "dtype of started_at is {} but has to be datetime64 and timezone aware".format(obj["started_at"].dtype)
+        assert pd.api.types.is_datetime64tz_dtype(
+            obj["finished_at"]
+        ), "dtype of finished_at is {} but has to be datetime64 and timezone aware".format(obj["finished_at"].dtype)
 
     def plot(self, *args, **kwargs):
         """
@@ -73,12 +77,10 @@ def to_csv(self, filename, *args, **kwargs):
         """
         ti.io.file.write_trips_csv(self._obj, filename, *args, **kwargs)
 
-    def to_postgis(self, conn_string, table_name, schema=None,
-                   sql_chunksize=None, if_exists='replace'):
+    def to_postgis(self, conn_string, table_name, schema=None, sql_chunksize=None, if_exists="replace"):
         """
         Store this collection of trips to PostGIS.
         
         See :func:`trackintel.io.postgis.write_trips_postgis`.
         """
-        ti.io.postgis.write_trips_postgis(self._obj, conn_string, table_name,
-                                          schema, sql_chunksize, if_exists)
+        ti.io.postgis.write_trips_postgis(self._obj, conn_string, table_name, schema, sql_chunksize, if_exists)
diff --git a/trackintel/model/users.py b/trackintel/model/users.py
index edbcdc27..b72d3278 100644
--- a/trackintel/model/users.py
+++ b/trackintel/model/users.py
@@ -20,7 +20,7 @@ class UsersAccessor(object):
     >>> df.as_users.plot_home_and_work()
     """
 
-    required_columns = ['id']
+    required_columns = ["id"]
 
     def __init__(self, pandas_obj):
         self._validate(pandas_obj)
@@ -29,9 +29,11 @@ def __init__(self, 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)))
+            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):
         """
diff --git a/trackintel/preprocessing/__init__.py b/trackintel/preprocessing/__init__.py
index f935b21e..3727dcf8 100644
--- a/trackintel/preprocessing/__init__.py
+++ b/trackintel/preprocessing/__init__.py
@@ -7,4 +7,4 @@
 from .staypoints import create_activity_flag
 
 from .triplegs import smoothen_triplegs
-from .triplegs import generate_trips
\ No newline at end of file
+from .triplegs import generate_trips
diff --git a/trackintel/preprocessing/filter.py b/trackintel/preprocessing/filter.py
index 36288465..599ccf76 100644
--- a/trackintel/preprocessing/filter.py
+++ b/trackintel/preprocessing/filter.py
@@ -1,7 +1,6 @@
 import geopandas as gpd
 
 
-
 def spatial_filter(source, areas, method="within", re_project=False):
     """
     Filter staypoints, locations or triplegs with a geo extent.
@@ -40,11 +39,11 @@ def spatial_filter(source, areas, method="within", re_project=False):
     >>> spts.as_staypoints.spatial_filter(areas, method="within", re_project=False)
     """
     gdf = source.copy()
-    
+
     if re_project:
         init_crs = gdf.crs
         gdf = gdf.to_crs(areas.crs)
-    
+
     # build spatial index for pre filtering
     source_sindex = gdf.sindex
     possible_matches_index = []
@@ -56,19 +55,20 @@ def spatial_filter(source, areas, method="within", re_project=False):
     # Get unique candidates
     unique_candidate_matches = list(set(possible_matches_index))
     possible_matches = gdf.iloc[unique_candidate_matches]
-    
+
     # get final result
-    if method == 'within':
+    if method == "within":
         ret_gdf = possible_matches.loc[possible_matches.within(areas.unary_union)]
-    elif method == 'intersects':
+    elif method == "intersects":
         ret_gdf = possible_matches.loc[possible_matches.intersects(areas.unary_union)]
-    elif method == 'crosses':
+    elif method == "crosses":
         ret_gdf = possible_matches.loc[possible_matches.crosses(areas.unary_union)]
     else:
-        raise AttributeError("method unknown. We only support ['within', 'intersects', 'crosses']. "
-                                f"You passed {method}")
-        
+        raise AttributeError(
+            "method unknown. We only support ['within', 'intersects', 'crosses']. " f"You passed {method}"
+        )
+
     if re_project:
         return ret_gdf.to_crs(init_crs)
     else:
-        return ret_gdf
\ No newline at end of file
+        return ret_gdf
diff --git a/trackintel/preprocessing/positionfixes.py b/trackintel/preprocessing/positionfixes.py
index ef2f6dae..11e8e277 100644
--- a/trackintel/preprocessing/positionfixes.py
+++ b/trackintel/preprocessing/positionfixes.py
@@ -164,6 +164,7 @@ def generate_staypoints(
 
     return pfs, stps
 
+
 def generate_triplegs(pfs_input, stps_input, method="between_staypoints", gap_threshold=15):
     """Generate triplegs from positionfixes.
 
@@ -239,7 +240,9 @@ def generate_triplegs(pfs_input, stps_input, method="between_staypoints", gap_th
                 # step 1
                 # All positionfixes with timestamp between staypoints are assigned the value 0
                 # Intersect all positionfixes of a user with all staypoints of the same user
-                intervals = pd.IntervalIndex.from_arrays(spts_user["started_at"], spts_user["finished_at"], closed="left")
+                intervals = pd.IntervalIndex.from_arrays(
+                    spts_user["started_at"], spts_user["finished_at"], closed="left"
+                )
                 is_in_interval = pfs_user["tracked_at"].apply(lambda x: intervals.contains(x).any()).astype("bool")
                 pfs.loc[is_in_interval[is_in_interval].index, "staypoint_id"] = 0
 
@@ -275,7 +278,7 @@ def generate_triplegs(pfs_input, stps_input, method="between_staypoints", gap_th
         # condition 3: stps
         # By our definition the pf after a stp is the first pf of a tpl.
         # this works only for numeric staypoint ids, TODO: can we change?
-        _stp_id = (pfs["staypoint_id"] + 1).fillna(0)  
+        _stp_id = (pfs["staypoint_id"] + 1).fillna(0)
         cond_stp = (_stp_id - _stp_id.shift(1)) != 0
 
         # special check for case 2: pfs that belong to stp might not present in the data.
@@ -288,11 +291,11 @@ def generate_triplegs(pfs_input, stps_input, method="between_staypoints", gap_th
         # make sure not to create triplegs within staypoints:
         cond_all = cond_all & pd.isna(pfs["staypoint_id"])
         cond_all.sort_index(inplace=True)
-        
+
         # get the start position of tpls
         tpls_starts = np.where(cond_all)[0]
         tpls_diff = np.diff(tpls_starts)
-        
+
         # get the start position of stps
         # pd.NA causes error in boolen comparision, replace to -1
         stps_id = pfs["staypoint_id"].copy().fillna(-1)
@@ -300,7 +303,7 @@ def generate_triplegs(pfs_input, stps_input, method="between_staypoints", gap_th
         # get the index of where the tpls_starts belong in stps_starts
         stps_starts = stps_starts[unique_stps != -1]
         tpls_place_in_stps = np.searchsorted(stps_starts, tpls_starts)
-        
+
         # get the length between each stp and tpl
         try:
             # pfs ends with stp
diff --git a/trackintel/preprocessing/staypoints.py b/trackintel/preprocessing/staypoints.py
index 55e6fac8..85de7e41 100644
--- a/trackintel/preprocessing/staypoints.py
+++ b/trackintel/preprocessing/staypoints.py
@@ -8,12 +8,9 @@
 from trackintel.geogr.distances import meters_to_decimal_degrees
 
 
-def generate_locations(staypoints,
-                       method='dbscan',
-                       epsilon=100,
-                       num_samples=1,
-                       distance_matrix_metric='euclidean',
-                       agg_level='user'):
+def generate_locations(
+    staypoints, method="dbscan", epsilon=100, num_samples=1, distance_matrix_metric="euclidean", agg_level="user"
+):
     """
     Generate locations from the staypoints.
 
@@ -56,123 +53,128 @@ def generate_locations(staypoints,
     --------
     >>> spts.as_staypoints.generate_locations(method='dbscan', epsilon=100, num_samples=1)
     """
-    if agg_level not in ['user', 'dataset']:
+    if agg_level not in ["user", "dataset"]:
         raise AttributeError("The parameter agg_level must be one of ['user', 'dataset'].")
-    if method not in ['dbscan']:
+    if method not in ["dbscan"]:
         raise AttributeError("The parameter method must be one of ['dbscan'].")
-    
+
     # initialize the return GeoDataFrames
     ret_stps = staypoints.copy()
-    
-    if method=='dbscan':
 
-        if distance_matrix_metric == 'haversine':
+    if method == "dbscan":
+
+        if distance_matrix_metric == "haversine":
             # The input and output of sklearn's harvarsine metrix are both in radians,
             # see https://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.haversine_distances.html
             # here the 'epsilon' is directly applied to the metric's output.
             # convert to radius
-            db = DBSCAN(eps=epsilon / 6371000 , min_samples=num_samples, algorithm='ball_tree', metric=distance_matrix_metric)
+            db = DBSCAN(
+                eps=epsilon / 6371000, min_samples=num_samples, algorithm="ball_tree", metric=distance_matrix_metric
+            )
         else:
-            db = DBSCAN(eps=epsilon, min_samples=num_samples, algorithm='ball_tree', metric=distance_matrix_metric)
-            
-        if agg_level == 'user':
+            db = DBSCAN(eps=epsilon, min_samples=num_samples, algorithm="ball_tree", metric=distance_matrix_metric)
+
+        if agg_level == "user":
             location_id_counter = 0
             # TODO: change into groupby
             for user_id_this in ret_stps["user_id"].unique():
                 # Slice staypoints array by user. This is not a copy!
-                user_staypoints = ret_stps[ret_stps["user_id"] == user_id_this]  
-                
-                if distance_matrix_metric == 'haversine':
+                user_staypoints = ret_stps[ret_stps["user_id"] == user_id_this]
+
+                if distance_matrix_metric == "haversine":
                     # the input is converted to list of (lat, lon) tuples in radians unit
                     p = np.array([[radians(g.y), radians(g.x)] for g in user_staypoints.geometry])
                 else:
                     p = np.array([[g.x, g.y] for g in user_staypoints.geometry])
                 labels = db.fit_predict(p)
-                    
+
                 # enforce unique lables across all users without changing noise labels
                 max_label = np.max(labels)
                 labels[labels != -1] = labels[labels != -1] + location_id_counter
                 if max_label > -1:
                     location_id_counter = location_id_counter + max_label + 1
-                
+
                 # add staypoint - location matching to original staypoints
-                ret_stps.loc[user_staypoints.index, 'location_id'] = labels
+                ret_stps.loc[user_staypoints.index, "location_id"] = labels
         else:
-            if distance_matrix_metric == 'haversine':
+            if distance_matrix_metric == "haversine":
                 # the input is converted to list of (lat, lon) tuples in radians unit
                 p = np.array([[radians(g.y), radians(g.x)] for g in ret_stps.geometry])
             else:
                 p = np.array([[g.x, g.y] for g in ret_stps.geometry])
             labels = db.fit_predict(p)
-            
-            ret_stps['location_id'] = labels
-            
+
+            ret_stps["location_id"] = labels
+
         ### create locations as grouped staypoints
-        temp_sp = ret_stps[['user_id', 'location_id', ret_stps.geometry.name]]
-        if agg_level == 'user':
+        temp_sp = ret_stps[["user_id", "location_id", ret_stps.geometry.name]]
+        if agg_level == "user":
             # directly dissolve by 'user_id' and 'location_id'
-            ret_loc = temp_sp.dissolve(by=['user_id', 'location_id'],as_index=False)
+            ret_loc = temp_sp.dissolve(by=["user_id", "location_id"], as_index=False)
         else:
             ## generate user-location pairs with same geometries across users
             # get user-location pairs
-            ret_loc = temp_sp.dissolve(by=['user_id', 'location_id'], as_index=False).drop(columns={'geom'})
+            ret_loc = temp_sp.dissolve(by=["user_id", "location_id"], as_index=False).drop(columns={"geom"})
             # get location geometries
-            geom_df = temp_sp.dissolve(by=['location_id'], as_index=False).drop(columns={'user_id'})
+            geom_df = temp_sp.dissolve(by=["location_id"], as_index=False).drop(columns={"user_id"})
             # merge pairs with location geometries
-            ret_loc = ret_loc.merge(geom_df, on='location_id', how='left')
-            
+            ret_loc = ret_loc.merge(geom_df, on="location_id", how="left")
+
         # filter stps not belonging to locations
-        ret_loc = ret_loc.loc[ret_loc['location_id'] != -1]
-        
-        ret_loc['center'] = None # initialize
+        ret_loc = ret_loc.loc[ret_loc["location_id"] != -1]
+
+        ret_loc["center"] = None  # initialize
         # locations with only one staypoints is of type "Point"
-        point_idx = ret_loc.geom_type == 'Point'
+        point_idx = ret_loc.geom_type == "Point"
         if not ret_loc.loc[point_idx].empty:
-            ret_loc.loc[point_idx, 'center'] = ret_loc.loc[point_idx, 'geom']
+            ret_loc.loc[point_idx, "center"] = ret_loc.loc[point_idx, "geom"]
         # locations with multiple staypoints is of type "MultiPoint"
         if not ret_loc.loc[~point_idx].empty:
-            ret_loc.loc[~point_idx, 'center'] = ret_loc.loc[~point_idx, 'geom'].apply(
-                lambda p: Point(np.array(p)[:,0].mean(), np.array(p)[:,1].mean()))
-        
+            ret_loc.loc[~point_idx, "center"] = ret_loc.loc[~point_idx, "geom"].apply(
+                lambda p: Point(np.array(p)[:, 0].mean(), np.array(p)[:, 1].mean())
+            )
+
         # extent is the convex hull of the geometry
-        ret_loc['extent'] = None # initialize
+        ret_loc["extent"] = None  # initialize
         if not ret_loc.empty:
-            ret_loc['extent'] = ret_loc['geom'].apply(lambda p: p.convex_hull)                                                                                        
-            # convex_hull of one point would be a Point and two points a Linestring, 
+            ret_loc["extent"] = ret_loc["geom"].apply(lambda p: p.convex_hull)
+            # convex_hull of one point would be a Point and two points a Linestring,
             # we change them into Polygon by creating a buffer of epsilon around them.
-            pointLine_idx = (ret_loc['extent'].geom_type == 'LineString') | (ret_loc['extent'].geom_type == 'Point')
-        
+            pointLine_idx = (ret_loc["extent"].geom_type == "LineString") | (ret_loc["extent"].geom_type == "Point")
+
             if not ret_loc.loc[pointLine_idx].empty:
                 # Perform meter to decimal conversion if the distance metric is haversine
-                if distance_matrix_metric == 'haversine':
-                    ret_loc.loc[pointLine_idx, 'extent'] = ret_loc.loc[pointLine_idx].apply(
-                        lambda p: p['extent'].buffer(meters_to_decimal_degrees(epsilon, p['center'].y)), axis=1)
+                if distance_matrix_metric == "haversine":
+                    ret_loc.loc[pointLine_idx, "extent"] = ret_loc.loc[pointLine_idx].apply(
+                        lambda p: p["extent"].buffer(meters_to_decimal_degrees(epsilon, p["center"].y)), axis=1
+                    )
                 else:
-                    ret_loc.loc[pointLine_idx, 'extent'] = ret_loc.loc[pointLine_idx].apply(
-                        lambda p: p['extent'].buffer(epsilon), axis=1)
-        
-        ret_loc = ret_loc.set_geometry('center')
-        ret_loc = ret_loc[['user_id', 'location_id', 'center', 'extent']]
+                    ret_loc.loc[pointLine_idx, "extent"] = ret_loc.loc[pointLine_idx].apply(
+                        lambda p: p["extent"].buffer(epsilon), axis=1
+                    )
+
+        ret_loc = ret_loc.set_geometry("center")
+        ret_loc = ret_loc[["user_id", "location_id", "center", "extent"]]
 
         # index management
-        ret_loc.rename(columns={'location_id':'id'}, inplace=True)
-        ret_loc.set_index('id', inplace=True)
-    
+        ret_loc.rename(columns={"location_id": "id"}, inplace=True)
+        ret_loc.set_index("id", inplace=True)
+
     # stps not linked to a location receive np.nan in 'location_id'
-    ret_stps.loc[ret_stps['location_id'] == -1, 'location_id'] = np.nan
-    
+    ret_stps.loc[ret_stps["location_id"] == -1, "location_id"] = np.nan
+
     ## dtype consistency
     # locs id (generated by this function) should be int64
-    ret_loc.index = ret_loc.index.astype('int64')
+    ret_loc.index = ret_loc.index.astype("int64")
     # location_id of spts can only be in Int64 (missing values)
-    ret_stps['location_id'] = ret_stps['location_id'].astype('Int64')
+    ret_stps["location_id"] = ret_stps["location_id"].astype("Int64")
     # user_id of ret_loc should be the same as ret_stps
-    ret_loc['user_id'] = ret_loc['user_id'].astype(ret_stps['user_id'].dtype)
-    
+    ret_loc["user_id"] = ret_loc["user_id"].astype(ret_stps["user_id"].dtype)
+
     return ret_stps, ret_loc
 
 
-def create_activity_flag(staypoints, method='time_threshold', time_threshold=5., activity_column_name='activity'):
+def create_activity_flag(staypoints, method="time_threshold", time_threshold=5.0, activity_column_name="activity"):
     """
     Add a flag whether or not a staypoint is considered an activity.
 
@@ -201,9 +203,10 @@ def create_activity_flag(staypoints, method='time_threshold', time_threshold=5.,
     >>> spts  = spts.as_staypoints.create_activity_flag(method='time_threshold', time_threshold=5)
     >>> print(spts['activity'])
     """
-    if method == 'time_threshold':
-        staypoints[activity_column_name] = staypoints['finished_at'] - staypoints['started_at'] \
-                                           > datetime.timedelta(minutes=time_threshold)
+    if method == "time_threshold":
+        staypoints[activity_column_name] = staypoints["finished_at"] - staypoints["started_at"] > datetime.timedelta(
+            minutes=time_threshold
+        )
     else:
         raise NameError("Method {} is not known".format(method))
 
diff --git a/trackintel/preprocessing/triplegs.py b/trackintel/preprocessing/triplegs.py
index c58b4cf6..a6a2f886 100644
--- a/trackintel/preprocessing/triplegs.py
+++ b/trackintel/preprocessing/triplegs.py
@@ -5,6 +5,7 @@
 import pandas as pd
 from tqdm import tqdm
 
+
 def smoothen_triplegs(triplegs, tolerance=1.0, preserve_topology=True):
     """
     Reduce number of points while retaining structure of tripleg.
@@ -81,120 +82,126 @@ def generate_trips(stps_input, tpls_input, gap_threshold=15, print_progress=Fals
     --------
     >>> staypoints, triplegs, trips = generate_trips(staypoints, triplegs)
     """
-    assert 'activity' in stps_input.columns, "staypoints need the column 'activities' \
+    assert (
+        "activity" in stps_input.columns
+    ), "staypoints need the column 'activities' \
                                          to be able to generate trips"
 
     # we copy the input because we need to add a temporary column
     tpls = tpls_input.copy()
     spts = stps_input.copy()
 
-    tpls['type'] = 'tripleg'
-    spts['type'] = 'staypoint'
+    tpls["type"] = "tripleg"
+    spts["type"] = "staypoint"
 
     # create table with relevant information from triplegs and staypoints.
-    spts_tpls = spts[['started_at', 'finished_at', 'user_id', 'type', 'activity']].append(
-        tpls[['started_at', 'finished_at', 'user_id', 'type']])
+    spts_tpls = spts[["started_at", "finished_at", "user_id", "type", "activity"]].append(
+        tpls[["started_at", "finished_at", "user_id", "type"]]
+    )
 
     # create ID field from index
-    spts_tpls['id'] = spts_tpls.index
+    spts_tpls["id"] = spts_tpls.index
 
     # transform nan to bool
-    spts_tpls['activity'] = spts_tpls['activity'] == True
+    spts_tpls["activity"] = spts_tpls["activity"] == True
+
+    spts_tpls.sort_values(by=["user_id", "started_at"], inplace=True)
+    spts_tpls["started_at_next"] = spts_tpls["started_at"].shift(-1)
+    spts_tpls["activity_next"] = spts_tpls["activity"].shift(-1)
 
-    spts_tpls.sort_values(by=['user_id', 'started_at'], inplace=True)
-    spts_tpls['started_at_next'] = spts_tpls['started_at'].shift(-1)
-    spts_tpls['activity_next'] = spts_tpls['activity'].shift(-1)
-    
     if print_progress:
-        tqdm.pandas(desc='User trip generation')
-        trips = spts_tpls.groupby(['user_id'], 
-                                  group_keys=False, 
-                                  as_index=False).progress_apply(_generate_trips_user, gap_threshold=gap_threshold).reset_index(drop=True)
+        tqdm.pandas(desc="User trip generation")
+        trips = (
+            spts_tpls.groupby(["user_id"], group_keys=False, as_index=False)
+            .progress_apply(_generate_trips_user, gap_threshold=gap_threshold)
+            .reset_index(drop=True)
+        )
     else:
-        trips = spts_tpls.groupby(['user_id'], 
-                                  group_keys=False, 
-                                  as_index=False).apply(_generate_trips_user, gap_threshold=gap_threshold).reset_index(drop=True)
-    
+        trips = (
+            spts_tpls.groupby(["user_id"], group_keys=False, as_index=False)
+            .apply(_generate_trips_user, gap_threshold=gap_threshold)
+            .reset_index(drop=True)
+        )
+
     # index management
-    trips['id'] = np.arange(len(trips))
-    trips.set_index('id', inplace=True)
-    
+    trips["id"] = np.arange(len(trips))
+    trips.set_index("id", inplace=True)
+
     # assign trip_id to tpls
-    trip2tpl_map = trips[['tpls']].to_dict()['tpls']
+    trip2tpl_map = trips[["tpls"]].to_dict()["tpls"]
     ls = []
     for key, values in trip2tpl_map.items():
         for value in values:
             ls.append([value, key])
-    temp = pd.DataFrame(ls, columns=[tpls.index.name, 'trip_id']).set_index(tpls.index.name)
-    tpls = tpls.join(temp, how='left')
-    
+    temp = pd.DataFrame(ls, columns=[tpls.index.name, "trip_id"]).set_index(tpls.index.name)
+    tpls = tpls.join(temp, how="left")
+
     # assign trip_id to spts, for non-activity spts
-    trip2spt_map = trips[['spts']].to_dict()['spts']
+    trip2spt_map = trips[["spts"]].to_dict()["spts"]
     ls = []
     for key, values in trip2spt_map.items():
         for value in values:
             ls.append([value, key])
-    temp = pd.DataFrame(ls, columns=[spts.index.name, 'trip_id']).set_index(spts.index.name)
-    spts = spts.join(temp, how='left')
-    
+    temp = pd.DataFrame(ls, columns=[spts.index.name, "trip_id"]).set_index(spts.index.name)
+    spts = spts.join(temp, how="left")
+
     # assign prev_trip_id to spts
-    temp = trips[['destination_staypoint_id']].copy()
-    temp.rename(columns={"destination_staypoint_id":spts.index.name}, inplace=True)
+    temp = trips[["destination_staypoint_id"]].copy()
+    temp.rename(columns={"destination_staypoint_id": spts.index.name}, inplace=True)
     temp.index.name = "prev_trip_id"
     temp = temp.reset_index().set_index(spts.index.name)
-    spts = spts.join(temp, how ='left')
-    
+    spts = spts.join(temp, how="left")
+
     # assign next_trip_id to spts
-    temp = trips[['origin_staypoint_id']].copy()
-    temp.rename(columns={"origin_staypoint_id":spts.index.name}, inplace=True)
+    temp = trips[["origin_staypoint_id"]].copy()
+    temp.rename(columns={"origin_staypoint_id": spts.index.name}, inplace=True)
     temp.index.name = "next_trip_id"
     temp = temp.reset_index().set_index(spts.index.name)
-    spts = spts.join(temp, how ='left')
-    
+    spts = spts.join(temp, how="left")
+
     # final cleaning
-    tpls.drop(columns=['type'], inplace=True)
-    spts.drop(columns=['type'], inplace=True)
-    trips.drop(columns = ['tpls', 'spts'], inplace=True)
-    
-    ## dtype consistency 
+    tpls.drop(columns=["type"], inplace=True)
+    spts.drop(columns=["type"], inplace=True)
+    trips.drop(columns=["tpls", "spts"], inplace=True)
+
+    ## dtype consistency
     # trips id (generated by this function) should be int64
-    trips.index = trips.index.astype('int64')
+    trips.index = trips.index.astype("int64")
     # trip id of spts and tpls can only be in Int64 (missing values)
-    spts['trip_id'] = spts['trip_id'].astype('Int64')
-    spts['prev_trip_id'] = spts['prev_trip_id'].astype('Int64')
-    spts['next_trip_id'] = spts['next_trip_id'].astype('Int64')
-    tpls['trip_id'] = tpls['trip_id'].astype('Int64')
-    
+    spts["trip_id"] = spts["trip_id"].astype("Int64")
+    spts["prev_trip_id"] = spts["prev_trip_id"].astype("Int64")
+    spts["next_trip_id"] = spts["next_trip_id"].astype("Int64")
+    tpls["trip_id"] = tpls["trip_id"].astype("Int64")
+
     # user_id of trips should be the same as tpls
-    trips['user_id'] = trips['user_id'].astype(tpls['user_id'].dtype)
-    
+    trips["user_id"] = trips["user_id"].astype(tpls["user_id"].dtype)
+
     return spts, tpls, trips
 
 
 def _generate_trips_user(df, gap_threshold):
     # function called after groupby: should only contain records of one user
-    user_id = df['user_id'].unique()
+    user_id = df["user_id"].unique()
     assert len(user_id) == 1
     user_id = user_id[0]
 
-    unknown_activity = {'user_id': user_id, 'activity': True, 'id': np.nan}
+    unknown_activity = {"user_id": user_id, "activity": True, "id": np.nan}
     origin_activity = unknown_activity
     temp_trip_stack = []
     in_trip = False
     trip_ls = []
 
     for _, row in df.iterrows():
-        
-        
+
         # check if we can start a new trip
         # (we make sure that we start the trip with the most recent activity)
         if in_trip is False:
             # If there are several activities in a row, we skip until the last one
-            if row['activity'] and row['activity_next']:
+            if row["activity"] and row["activity_next"]:
                 continue
 
             # if this is the last activity before the trip starts, reset the origin
-            elif row['activity']:
+            elif row["activity"]:
                 origin_activity = row
                 in_trip = True
                 continue
@@ -202,12 +209,12 @@ def _generate_trips_user(df, gap_threshold):
             # if for non-activities we simply start the trip
             else:
                 in_trip = True
-                
+
         if in_trip is True:
             # during trip generation/recording
 
             # check if trip ends regularly
-            if row['activity'] is True:
+            if row["activity"] is True:
 
                 # if there are no triplegs in the trip, set the current activity as origin and start over
                 if not _check_trip_stack_has_tripleg(temp_trip_stack):
@@ -218,10 +225,10 @@ def _generate_trips_user(df, gap_threshold):
                 else:
                     # record trip
                     destination_activity = row
-                    trip_ls.append(_create_trip_from_stack(temp_trip_stack, origin_activity,destination_activity))
+                    trip_ls.append(_create_trip_from_stack(temp_trip_stack, origin_activity, destination_activity))
 
                     # set values for next trip
-                    if row['started_at_next'] - row['finished_at'] > datetime.timedelta(minutes=gap_threshold):
+                    if row["started_at_next"] - row["finished_at"] > datetime.timedelta(minutes=gap_threshold):
                         # if there is a gap after this trip the origin of the next trip is unknown
                         origin_activity = unknown_activity
                         destination_activity = None
@@ -237,7 +244,7 @@ def _generate_trips_user(df, gap_threshold):
                         in_trip = False
 
             # check if gap during the trip
-            elif row['started_at_next'] - row['finished_at'] > datetime.timedelta(minutes=gap_threshold):
+            elif row["started_at_next"] - row["finished_at"] > datetime.timedelta(minutes=gap_threshold):
                 # in case of a gap, the destination of the current trip and the origin of the next trip
                 # are unknown.
 
@@ -254,7 +261,7 @@ def _generate_trips_user(df, gap_threshold):
                     # add tripleg to trip, generate trip, start new trip with unknown origin
                     destination_activity = unknown_activity
 
-                    trip_ls.append(_create_trip_from_stack(temp_trip_stack, origin_activity,destination_activity))
+                    trip_ls.append(_create_trip_from_stack(temp_trip_stack, origin_activity, destination_activity))
                     origin_activity = unknown_activity
                     destination_activity = None
                     temp_trip_stack = list()
@@ -262,12 +269,12 @@ def _generate_trips_user(df, gap_threshold):
 
             else:
                 temp_trip_stack.append(row)
-    
+
     # if user ends generate last trip with unknown destination
     if (len(temp_trip_stack) > 0) and (_check_trip_stack_has_tripleg(temp_trip_stack)):
         destination_activity = unknown_activity
-        trip_ls.append(_create_trip_from_stack(temp_trip_stack, origin_activity,destination_activity,))
-    
+        trip_ls.append(_create_trip_from_stack(temp_trip_stack, origin_activity, destination_activity,))
+
     # print(trip_ls)
     trips = pd.DataFrame(trip_ls)
     return trips
@@ -289,7 +296,7 @@ def _check_trip_stack_has_tripleg(temp_trip_stack):
     """
     has_tripleg = False
     for row in temp_trip_stack:
-        if row['type'] == 'tripleg':
+        if row["type"] == "tripleg":
             has_tripleg = True
             break
 
@@ -322,19 +329,21 @@ def _create_trip_from_stack(temp_trip_stack, origin_activity, destination_activi
     last_trip_element = temp_trip_stack[-1]
 
     # all data has to be from the same user
-    assert origin_activity['user_id'] == last_trip_element['user_id']
+    assert origin_activity["user_id"] == last_trip_element["user_id"]
 
     # double check if trip requirements are fulfilled
-    assert origin_activity['activity'] == True
-    assert destination_activity['activity'] == True
-    assert first_trip_element['activity'] == False
-
-    trip_dict_entry = {'user_id': origin_activity['user_id'],
-                       'started_at': first_trip_element['started_at'],
-                       'finished_at': last_trip_element['finished_at'],
-                       'origin_staypoint_id': origin_activity['id'],
-                       'destination_staypoint_id': destination_activity['id'],
-                       'tpls': [tripleg['id'] for tripleg in temp_trip_stack if tripleg['type'] == 'tripleg'],
-                       'spts': [tripleg['id'] for tripleg in temp_trip_stack if tripleg['type'] == 'staypoint']}
-    
+    assert origin_activity["activity"] == True
+    assert destination_activity["activity"] == True
+    assert first_trip_element["activity"] == False
+
+    trip_dict_entry = {
+        "user_id": origin_activity["user_id"],
+        "started_at": first_trip_element["started_at"],
+        "finished_at": last_trip_element["finished_at"],
+        "origin_staypoint_id": origin_activity["id"],
+        "destination_staypoint_id": destination_activity["id"],
+        "tpls": [tripleg["id"] for tripleg in temp_trip_stack if tripleg["type"] == "tripleg"],
+        "spts": [tripleg["id"] for tripleg in temp_trip_stack if tripleg["type"] == "staypoint"],
+    }
+
     return trip_dict_entry
diff --git a/trackintel/preprocessing/util.py b/trackintel/preprocessing/util.py
index fbe0300d..e14485ba 100644
--- a/trackintel/preprocessing/util.py
+++ b/trackintel/preprocessing/util.py
@@ -21,11 +21,11 @@ def calc_temp_overlap(start_1, end_1, start_2, end_2):
     """
 
     # case 1: no overlap - 1 was before 2
-    if (end_1 < start_2):
+    if end_1 < start_2:
         return 0
 
     # case 2: no overlap - 1 comes after 2
-    elif (end_2 < start_1):
+    elif end_2 < start_1:
         return 0
 
     # case 3: 2 fully in 1
diff --git a/trackintel/visualization/__init__.py b/trackintel/visualization/__init__.py
index da209c6e..0243e011 100644
--- a/trackintel/visualization/__init__.py
+++ b/trackintel/visualization/__init__.py
@@ -6,4 +6,4 @@
 
 from .staypoints import plot_staypoints
 
-from .triplegs import plot_triplegs
\ No newline at end of file
+from .triplegs import plot_triplegs
diff --git a/trackintel/visualization/locations.py b/trackintel/visualization/locations.py
index 0692aba6..5a17cf3b 100644
--- a/trackintel/visualization/locations.py
+++ b/trackintel/visualization/locations.py
@@ -80,4 +80,4 @@ def plot_center_of_locations(
     if out_filename is not None:
         save_fig(out_filename, formats=["png"])
     else:
-        plt.show()
\ No newline at end of file
+        plt.show()
diff --git a/trackintel/visualization/modal_split.py b/trackintel/visualization/modal_split.py
index 938d0309..83937a19 100644
--- a/trackintel/visualization/modal_split.py
+++ b/trackintel/visualization/modal_split.py
@@ -4,9 +4,21 @@
 from trackintel.visualization.util import regular_figure, save_fig
 
 
-def plot_modal_split(df_modal_split_in, out_path=None, date_fmt_x_axis='%W', axis=None,
-                     title=None, x_label=None, y_label=None, x_pad=10, y_pad=10, title_pad=1.02, skip_xticks=0,
-                     n_col_legend=5, borderaxespad=0.5):
+def plot_modal_split(
+    df_modal_split_in,
+    out_path=None,
+    date_fmt_x_axis="%W",
+    axis=None,
+    title=None,
+    x_label=None,
+    y_label=None,
+    x_pad=10,
+    y_pad=10,
+    title_pad=1.02,
+    skip_xticks=0,
+    n_col_legend=5,
+    borderaxespad=0.5,
+):
     """
     Plot modal split as returned by `trackintel.analysis.modal_split.calculate_modal_split`
 
@@ -55,12 +67,16 @@ def plot_modal_split(df_modal_split_in, out_path=None, date_fmt_x_axis='%W', axi
 
     # make sure that modal split is only of a single user
     if isinstance(df_modal_split.index[0], tuple):
-        raise ValueError("This function can not support multiindex types. Use 'pandas.MultiIndex.droplevel' or pass "
-                         "the `per_user=False` flag in 'calculate_modal_split' function.")
+        raise ValueError(
+            "This function can not support multiindex types. Use 'pandas.MultiIndex.droplevel' or pass "
+            "the `per_user=False` flag in 'calculate_modal_split' function."
+        )
 
     if not is_datetime64_any_dtype(df_modal_split.index.dtype):
-        raise ValueError("Index of modal split has to be a datetime type. This problem can be solved if the 'freq' "
-                         "keyword of 'calculate_modal_split is not None'")
+        raise ValueError(
+            "Index of modal split has to be a datetime type. This problem can be solved if the 'freq' "
+            "keyword of 'calculate_modal_split is not None'"
+        )
     # set date formatter
     df_modal_split.index = df_modal_split.index.map(lambda s: s.strftime(date_fmt_x_axis))
 
@@ -70,18 +86,23 @@ def plot_modal_split(df_modal_split_in, out_path=None, date_fmt_x_axis='%W', axi
     # skip ticks for X axis
     if skip_xticks > 0:
         for i, tick in enumerate(ax.xaxis.get_major_ticks()):
-            if (i % skip_xticks == 0):
+            if i % skip_xticks == 0:
                 tick.set_visible(False)
 
     # We use a nice trick to put the legend out of the plot and to scale it automatically
     # https://stackoverflow.com/questions/4700614/how-to-put-the-legend-out-of-the-plot
     box = ax.get_position()
-    ax.set_position([box.x0, box.y0 + box.height * 0.1,
-                     box.width, box.height * 0.9])
+    ax.set_position([box.x0, box.y0 + box.height * 0.1, box.width, box.height * 0.9])
 
     # Put a legend below current axis
-    ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.05),
-              fancybox=True, frameon=False, ncol=n_col_legend, borderaxespad=borderaxespad)
+    ax.legend(
+        loc="upper center",
+        bbox_to_anchor=(0.5, -0.05),
+        fancybox=True,
+        frameon=False,
+        ncol=n_col_legend,
+        borderaxespad=borderaxespad,
+    )
 
     if title is not None:
         plt.title(title, y=title_pad)
diff --git a/trackintel/visualization/osm.py b/trackintel/visualization/osm.py
index 33d53c16..5d0963f1 100644
--- a/trackintel/visualization/osm.py
+++ b/trackintel/visualization/osm.py
@@ -23,20 +23,20 @@ def plot_osm_streets(north, south, east, west, ax):
         The westernmost coordinate.
     """
     try:
-        G = ox.graph_from_bbox(north, south, east, west, network_type='drive')
+        G = ox.graph_from_bbox(north, south, east, west, network_type="drive")
         lines = []
         for u, v, data in G.edges(keys=False, data=True):
-            if 'geometry' in data:
-                xs, ys = data['geometry'].xy
+            if "geometry" in data:
+                xs, ys = data["geometry"].xy
                 lines.append(list(zip(xs, ys)))
             else:
-                x1 = G.nodes[u]['x']
-                y1 = G.nodes[u]['y']
-                x2 = G.nodes[v]['x']
-                y2 = G.nodes[v]['y']
+                x1 = G.nodes[u]["x"]
+                y1 = G.nodes[u]["y"]
+                x2 = G.nodes[v]["x"]
+                y2 = G.nodes[v]["y"]
                 line = [(x1, y1), (x2, y2)]
                 lines.append(line)
-        lc = LineCollection(lines, colors='#999999', linewidths=0.5, alpha=1, zorder=0)
+        lc = LineCollection(lines, colors="#999999", linewidths=0.5, alpha=1, zorder=0)
         ax.add_collection(lc)
     except NetworkXPointlessConcept as e:
-        logging.warn("Plotting of OSM graph failed: %s", e)
\ No newline at end of file
+        logging.warn("Plotting of OSM graph failed: %s", e)
diff --git a/trackintel/visualization/util.py b/trackintel/visualization/util.py
index 5a370d64..8fe74e7f 100644
--- a/trackintel/visualization/util.py
+++ b/trackintel/visualization/util.py
@@ -58,7 +58,7 @@ def a4_figsize(fig_height_mm=None, columns=2):
     fig_width = fig_width_mm.to(ureg.inch).magnitude
     fig_height = fig_height_mm.to(ureg.inch).magnitude
 
-    logging.info('Creating figure of %sx%s.' % (fig_width_mm, fig_height_mm))
+    logging.info("Creating figure of %sx%s." % (fig_width_mm, fig_height_mm))
     return fig_width, fig_height
 
 
@@ -72,16 +72,16 @@ def regular_figure():
     """
 
     params = {
-        'axes.labelsize': 7,  # Fontsize for x and y labels (originally 10).
-        'axes.titlesize': 7,
-        'font.size': 7,  # Originally 10.
-        'legend.fontsize': 7,  # Originally 10.
-        'xtick.labelsize': 7,
-        'ytick.labelsize': 7,
-        'grid.linewidth': 0.8,
-        'grid.linestyle': ':',
-        'legend.frameon': True,
-        'figure.dpi': 600,
+        "axes.labelsize": 7,  # Fontsize for x and y labels (originally 10).
+        "axes.titlesize": 7,
+        "font.size": 7,  # Originally 10.
+        "legend.fontsize": 7,  # Originally 10.
+        "xtick.labelsize": 7,
+        "ytick.labelsize": 7,
+        "grid.linewidth": 0.8,
+        "grid.linestyle": ":",
+        "legend.frameon": True,
+        "figure.dpi": 600,
     }
     matplotlib.rcParams.update(params)
     fig = plt.figure(figsize=a4_figsize(columns=2))
@@ -90,7 +90,7 @@ def regular_figure():
     return fig, ax
 
 
-def save_fig(out_filename, tight='tight', formats=['png', 'pdf']):
+def save_fig(out_filename, tight="tight", formats=["png", "pdf"]):
     """Saves a figure to a file.
 
     Parameters
@@ -103,19 +103,19 @@ def save_fig(out_filename, tight='tight', formats=['png', 'pdf']):
         A list denoting in which formats this figure should be saved ('png' or 'pdf').
     """
 
-    if out_filename.endswith('.png'):
+    if out_filename.endswith(".png"):
         outpath = out_filename
     else:
-        outpath = out_filename + '.png'
-    if 'png' in formats:
+        outpath = out_filename + ".png"
+    if "png" in formats:
         logging.info("Creating png...")
         ts = time.time()
         plt.savefig(outpath, dpi=600, bbox_inches=tight, pad_inches=0)
         logging.info("...took {} s!".format(round(time.time() - ts, 2)))
-    if 'pdf' in formats:
+    if "pdf" in formats:
         logging.info("Creating pdf...")
         ts = time.time()
-        plt.savefig(outpath.replace('.png', '.pdf'), bbox_inches=tight, pad_inches=0)
+        plt.savefig(outpath.replace(".png", ".pdf"), bbox_inches=tight, pad_inches=0)
         logging.info("...took {} s!".format(round(time.time() - ts, 2)))
     plt.close()
     logging.info("Finished!")
@@ -134,7 +134,7 @@ def transform_gdf_to_wgs84(gdf):
     -------
     >>> gdf = transform_gdf_to_wgs84(gdf)
     """
-    crs_wgs84 = 'EPSG:4326'
+    crs_wgs84 = "EPSG:4326"
     if gdf.crs is None:
         warnings.warn("Coordinate System (CRS) is not set, default to WGS84.")
         gdf.crs = crs_wgs84


Test patch:
diff --git a/tests/analysis/test_modal_split.py b/tests/analysis/test_modal_split.py
index 7f41abdc..001a9db2 100644
--- a/tests/analysis/test_modal_split.py
+++ b/tests/analysis/test_modal_split.py
@@ -13,12 +13,10 @@
 
 @pytest.fixture
 def read_geolife_with_modes():
-    pfs, labels = read_geolife(os.path.join('tests', 'data', 'geolife_modes'))
+    pfs, labels = read_geolife(os.path.join("tests", "data", "geolife_modes"))
 
-    pfs, spts = pfs.as_positionfixes.generate_staypoints(method='sliding',
-                                                         dist_threshold=25,
-                                                         time_threshold=5)
-    _, tpls = pfs.as_positionfixes.generate_triplegs(spts, method='between_staypoints')
+    pfs, spts = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=25, time_threshold=5)
+    _, tpls = pfs.as_positionfixes.generate_triplegs(spts, method="between_staypoints")
 
     tpls_with_modes = geolife_add_modes_to_triplegs(tpls, labels)
     return tpls_with_modes
@@ -46,34 +44,68 @@ def test_triplegs_modal_split(ls_short, ls_long):
     user 1: day 1: 1 tripleg (walk)
     """
 
-    day_1_h1 = pd.Timestamp('1970-01-01 00:00:00', tz='utc')
-    day_1_h2 = pd.Timestamp('1970-01-01 02:00:00', tz='utc')
-    day_2_h1 = pd.Timestamp('1970-01-02 02:00:00', tz='utc')
-    day_8_h1 = pd.Timestamp('1970-01-08 02:00:00', tz='utc')
+    day_1_h1 = pd.Timestamp("1970-01-01 00:00:00", tz="utc")
+    day_1_h2 = pd.Timestamp("1970-01-01 02:00:00", tz="utc")
+    day_2_h1 = pd.Timestamp("1970-01-02 02:00:00", tz="utc")
+    day_8_h1 = pd.Timestamp("1970-01-08 02:00:00", tz="utc")
 
     one_hour = datetime.timedelta(hours=1)
     one_min = datetime.timedelta(minutes=1)
 
-    list_dict = [{'id': 0, 'user_id': 0, 'started_at': day_1_h1, 'finished_at': day_1_h1 + one_hour,
-                  'geometry': ls_short, 'mode': 'car'},
-                 {'id': 1, 'user_id': 0, 'started_at': day_1_h2, 'finished_at': day_1_h2 + one_min, 'geometry': ls_long,
-                  'mode': 'bike'},
-                 {'id': 2, 'user_id': 0, 'started_at': day_2_h1, 'finished_at': day_2_h1 + one_hour,
-                  'geometry': ls_short,
-                  'mode': 'walk'},
-                 {'id': 3, 'user_id': 0, 'started_at': day_8_h1, 'finished_at': day_8_h1 + one_hour,
-                  'geometry': ls_short,
-                  'mode': 'walk'},
-                 {'id': 4, 'user_id': 1, 'started_at': day_1_h1, 'finished_at': day_1_h1 + one_hour,
-                  'geometry': ls_long,
-                  'mode': 'walk'},
-                 {'id': 5, 'user_id': 1, 'started_at': day_1_h2, 'finished_at': day_1_h2 + one_hour,
-                  'geometry': ls_long,
-                  'mode': 'walk'}]
+    list_dict = [
+        {
+            "id": 0,
+            "user_id": 0,
+            "started_at": day_1_h1,
+            "finished_at": day_1_h1 + one_hour,
+            "geometry": ls_short,
+            "mode": "car",
+        },
+        {
+            "id": 1,
+            "user_id": 0,
+            "started_at": day_1_h2,
+            "finished_at": day_1_h2 + one_min,
+            "geometry": ls_long,
+            "mode": "bike",
+        },
+        {
+            "id": 2,
+            "user_id": 0,
+            "started_at": day_2_h1,
+            "finished_at": day_2_h1 + one_hour,
+            "geometry": ls_short,
+            "mode": "walk",
+        },
+        {
+            "id": 3,
+            "user_id": 0,
+            "started_at": day_8_h1,
+            "finished_at": day_8_h1 + one_hour,
+            "geometry": ls_short,
+            "mode": "walk",
+        },
+        {
+            "id": 4,
+            "user_id": 1,
+            "started_at": day_1_h1,
+            "finished_at": day_1_h1 + one_hour,
+            "geometry": ls_long,
+            "mode": "walk",
+        },
+        {
+            "id": 5,
+            "user_id": 1,
+            "started_at": day_1_h2,
+            "finished_at": day_1_h2 + one_hour,
+            "geometry": ls_long,
+            "mode": "walk",
+        },
+    ]
 
     df = pd.DataFrame(list_dict)
-    gdf = gpd.GeoDataFrame(df).set_geometry('geometry')
-    gdf = gdf.set_crs('wgs84')
+    gdf = gpd.GeoDataFrame(df).set_geometry("geometry")
+    gdf = gdf.set_crs("wgs84")
     return gdf
 
 
@@ -82,8 +114,8 @@ def test_run_modal_split_with_geolife(self, read_geolife_with_modes):
         """check if we can run all possible combinations with a small sample of the geolife data"""
 
         tpls = read_geolife_with_modes
-        metric_list = ['duration', 'distance', 'count']
-        freq_list = [None, 'D', 'W-MON']
+        metric_list = ["duration", "distance", "count"]
+        freq_list = [None, "D", "W-MON"]
         per_user_list = [False, True]
         norm_list = [True, False]
 
@@ -100,7 +132,7 @@ def test_run_modal_split_with_geolife_accessors(self, read_geolife_with_modes):
         """check if we can access `calculate_modal_split` via the tripelg accessor"""
 
         tpls = read_geolife_with_modes
-        tpls.as_triplegs.calculate_modal_split(metric='count', freq='D')
+        tpls.as_triplegs.calculate_modal_split(metric="count", freq="D")
 
         # we only check if it runs through successfully
         assert True
@@ -108,68 +140,68 @@ def test_run_modal_split_with_geolife_accessors(self, read_geolife_with_modes):
     def test_modal_split_total_count(self, test_triplegs_modal_split):
         """Check counts per user and mode without temporal binning"""
         tpls = test_triplegs_modal_split
-        modal_split = calculate_modal_split(tpls, metric='count', per_user=True)
+        modal_split = calculate_modal_split(tpls, metric="count", per_user=True)
 
         # if the user get merged, walk would be larger than bike
-        assert modal_split.loc[0, 'bike'] == 1
-        assert modal_split.loc[0, 'car'] == 1
-        assert modal_split.loc[0, 'walk'] == 2
-        assert modal_split.loc[1, 'walk'] == 2
+        assert modal_split.loc[0, "bike"] == 1
+        assert modal_split.loc[0, "car"] == 1
+        assert modal_split.loc[0, "walk"] == 2
+        assert modal_split.loc[1, "walk"] == 2
 
     def test_modal_split_total_no_user_count(self, test_triplegs_modal_split):
         """Check counts without users and without temporal binning"""
         tpls = test_triplegs_modal_split
-        modal_split = calculate_modal_split(tpls, metric='count', per_user=False)
+        modal_split = calculate_modal_split(tpls, metric="count", per_user=False)
 
         # if the user get merged, walk would be larger than bike
-        assert modal_split.loc[0, 'bike'] == 1
-        assert modal_split.loc[0, 'car'] == 1
-        assert modal_split.loc[0, 'walk'] == 4
+        assert modal_split.loc[0, "bike"] == 1
+        assert modal_split.loc[0, "car"] == 1
+        assert modal_split.loc[0, "walk"] == 4
 
     def test_modal_split_total_distance(self, test_triplegs_modal_split):
         """Check distances per user and mode without temporal binning"""
         tpls = test_triplegs_modal_split
-        modal_split = calculate_modal_split(tpls, metric='distance', per_user=True)
+        modal_split = calculate_modal_split(tpls, metric="distance", per_user=True)
 
         # if the users would get merged, walk would be larger than bike
-        assert modal_split.loc[0, 'bike'] > modal_split.loc[0, 'walk']
-        assert modal_split.loc[0, 'walk'] > modal_split.loc[0, 'car']
+        assert modal_split.loc[0, "bike"] > modal_split.loc[0, "walk"]
+        assert modal_split.loc[0, "walk"] > modal_split.loc[0, "car"]
 
     def test_modal_split_total_duration(self, test_triplegs_modal_split):
         """Check duration per user and mode without temporal binning"""
         tpls = test_triplegs_modal_split
-        modal_split = calculate_modal_split(tpls, metric='duration', per_user=True)
+        modal_split = calculate_modal_split(tpls, metric="duration", per_user=True)
 
-        assert np.isclose(modal_split.loc[0, 'bike'], datetime.timedelta(minutes=1).total_seconds())
-        assert np.isclose(modal_split.loc[0, 'car'], datetime.timedelta(hours=1).total_seconds())
-        assert np.isclose(modal_split.loc[0, 'walk'], datetime.timedelta(hours=2).total_seconds())
-        assert np.isclose(modal_split.loc[1, 'walk'], datetime.timedelta(hours=2).total_seconds())
+        assert np.isclose(modal_split.loc[0, "bike"], datetime.timedelta(minutes=1).total_seconds())
+        assert np.isclose(modal_split.loc[0, "car"], datetime.timedelta(hours=1).total_seconds())
+        assert np.isclose(modal_split.loc[0, "walk"], datetime.timedelta(hours=2).total_seconds())
+        assert np.isclose(modal_split.loc[1, "walk"], datetime.timedelta(hours=2).total_seconds())
 
     def test_modal_split_daily_count(self, test_triplegs_modal_split):
         """Check counts per user and mode binned by day"""
         tpls = test_triplegs_modal_split
-        modal_split = calculate_modal_split(tpls, metric='count', freq='D', per_user=True)
+        modal_split = calculate_modal_split(tpls, metric="count", freq="D", per_user=True)
 
-        t_1 = pd.Timestamp('1970-01-01 00:00:00', tz='utc')
-        t_2 = pd.Timestamp('1970-01-02 00:00:00', tz='utc')
-        t_8 = pd.Timestamp('1970-01-08 00:00:00', tz='utc')
+        t_1 = pd.Timestamp("1970-01-01 00:00:00", tz="utc")
+        t_2 = pd.Timestamp("1970-01-02 00:00:00", tz="utc")
+        t_8 = pd.Timestamp("1970-01-08 00:00:00", tz="utc")
 
-        assert modal_split.loc[[(0, t_1)], 'bike'][0] == 1
-        assert modal_split.loc[[(0, t_1)], 'car'][0] == 1
-        assert modal_split.loc[[(0, t_2)], 'walk'][0] == 1
-        assert modal_split.loc[[(0, t_8)], 'walk'][0] == 1
-        assert modal_split.loc[[(1, t_1)], 'walk'][0] == 2
+        assert modal_split.loc[[(0, t_1)], "bike"][0] == 1
+        assert modal_split.loc[[(0, t_1)], "car"][0] == 1
+        assert modal_split.loc[[(0, t_2)], "walk"][0] == 1
+        assert modal_split.loc[[(0, t_8)], "walk"][0] == 1
+        assert modal_split.loc[[(1, t_1)], "walk"][0] == 2
 
     def test_modal_split_weekly_count(self, test_triplegs_modal_split):
         """Check counts per user and mode binned by week"""
         tpls = test_triplegs_modal_split
-        modal_split = calculate_modal_split(tpls, metric='count', freq='W-MON', per_user=True)
+        modal_split = calculate_modal_split(tpls, metric="count", freq="W-MON", per_user=True)
 
-        w_1 = pd.Timestamp('1970-01-05 00:00:00', tz='utc')  # data is aggregated to the next monday
-        w_2 = pd.Timestamp('1970-01-12 00:00:00', tz='utc')
+        w_1 = pd.Timestamp("1970-01-05 00:00:00", tz="utc")  # data is aggregated to the next monday
+        w_2 = pd.Timestamp("1970-01-12 00:00:00", tz="utc")
 
-        assert modal_split.loc[[(0, w_1)], 'bike'][0] == 1
-        assert modal_split.loc[[(0, w_1)], 'car'][0] == 1
-        assert modal_split.loc[[(0, w_1)], 'walk'][0] == 1
-        assert modal_split.loc[[(0, w_2)], 'walk'][0] == 1
-        assert modal_split.loc[[(1, w_1)], 'walk'][0] == 2
+        assert modal_split.loc[[(0, w_1)], "bike"][0] == 1
+        assert modal_split.loc[[(0, w_1)], "car"][0] == 1
+        assert modal_split.loc[[(0, w_1)], "walk"][0] == 1
+        assert modal_split.loc[[(0, w_2)], "walk"][0] == 1
+        assert modal_split.loc[[(1, w_1)], "walk"][0] == 2
diff --git a/tests/analysis/test_tracking_quality.py b/tests/analysis/test_tracking_quality.py
index f0cedea8..a935bace 100644
--- a/tests/analysis/test_tracking_quality.py
+++ b/tests/analysis/test_tracking_quality.py
@@ -33,9 +33,9 @@ def test_tracking_quality_all(self, testdata_stps_tpls_geolife_long):
 
         # test if the result of the user agrees
         quality = ti.analysis.tracking_quality.temporal_tracking_quality(stps_tpls, granularity="all")
-        
+
         assert quality_manual == quality.loc[quality["user_id"] == 0, "quality"].values[0]
-        assert (quality['quality']<=1).all()
+        assert (quality["quality"] <= 1).all()
 
     def test_tracking_quality_day(self, testdata_stps_tpls_geolife_long):
         """Test if the calculated tracking quality per day is correct."""
@@ -54,7 +54,7 @@ def test_tracking_quality_day(self, testdata_stps_tpls_geolife_long):
         quality = ti.analysis.tracking_quality.temporal_tracking_quality(stps_tpls, granularity="day")
 
         assert quality_manual == quality.loc[(quality["user_id"] == 0) & (quality["day"] == 0), "quality"].values[0]
-        assert (quality['quality']<1).all()
+        assert (quality["quality"] < 1).all()
 
     def test_tracking_quality_week(self, testdata_stps_tpls_geolife_long):
         """Test if the calculated tracking quality per week is correct."""
@@ -76,7 +76,7 @@ def test_tracking_quality_week(self, testdata_stps_tpls_geolife_long):
         quality = ti.analysis.tracking_quality.temporal_tracking_quality(stps_tpls, granularity="week")
 
         assert quality_manual == quality.loc[(quality["user_id"] == 0), "quality"].values[0]
-        assert (quality['quality']<1).all()
+        assert (quality["quality"] < 1).all()
 
     def test_tracking_quality_weekday(self, testdata_stps_tpls_geolife_long):
         """Test if the calculated tracking quality per weekday is correct."""
@@ -100,7 +100,7 @@ def test_tracking_quality_weekday(self, testdata_stps_tpls_geolife_long):
         quality = ti.analysis.tracking_quality.temporal_tracking_quality(stps_tpls, granularity="weekday")
 
         assert quality_manual == quality.loc[(quality["user_id"] == 0) & (quality["weekday"] == 3), "quality"].values[0]
-        assert (quality['quality']<1).all()
+        assert (quality["quality"] < 1).all()
 
     def test_tracking_quality_hour(self, testdata_stps_tpls_geolife_long):
         """Test if the calculated tracking quality per hour is correct."""
@@ -124,7 +124,7 @@ def test_tracking_quality_hour(self, testdata_stps_tpls_geolife_long):
         quality = ti.analysis.tracking_quality.temporal_tracking_quality(stps_tpls, granularity="hour")
 
         assert quality_manual == quality.loc[(quality["user_id"] == 0) & (quality["hour"] == 2), "quality"].values[0]
-        assert (quality['quality']<1).all()
+        assert (quality["quality"] < 1).all()
 
     def test_tracking_quality_error(self, testdata_stps_tpls_geolife_long):
         """Test if the an error is raised when passing unknown 'granularity' to temporal_tracking_quality()."""
@@ -134,29 +134,27 @@ def test_tracking_quality_error(self, testdata_stps_tpls_geolife_long):
             ti.analysis.tracking_quality.temporal_tracking_quality(stps_tpls, granularity=12345)
         with pytest.raises(AttributeError):
             ti.analysis.tracking_quality.temporal_tracking_quality(stps_tpls, granularity="random")
-            
+
     def test_tracking_quality_wrong_datamodel(self, testdata_stps_tpls_geolife_long):
         """Test if the a keyerror is raised when passing incorrect datamodels."""
         # read positionfixes and feed to temporal_tracking_quality()
         pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife_long"))
         with pytest.raises(KeyError):
             ti.analysis.tracking_quality.temporal_tracking_quality(pfs)
-        
+
         # generate locations and feed to temporal_tracking_quality()
-        stps_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-        stps = ti.read_staypoints_csv(stps_file, tz='utc', index_col='id')
-        _, locs = stps.as_staypoints.generate_locations(method='dbscan',
-                                                        epsilon=10,
-                                                        num_samples=0,
-                                                        distance_matrix_metric='haversine',
-                                                        agg_level='dataset')
+        stps_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+        stps = ti.read_staypoints_csv(stps_file, tz="utc", index_col="id")
+        _, locs = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=10, num_samples=0, distance_matrix_metric="haversine", agg_level="dataset"
+        )
         with pytest.raises(KeyError):
             ti.analysis.tracking_quality.temporal_tracking_quality(locs)
-            
+
     def test_tracking_quality_user_error(self, testdata_stps_tpls_geolife_long):
         """Test if the an error is raised when passing unknown 'granularity' to _get_tracking_quality_user()."""
         stps_tpls = testdata_stps_tpls_geolife_long
-        user_0 = stps_tpls.loc[stps_tpls['user_id'] == 0] 
+        user_0 = stps_tpls.loc[stps_tpls["user_id"] == 0]
 
         with pytest.raises(AttributeError):
             ti.analysis.tracking_quality._get_tracking_quality_user(user_0, granularity=12345)
@@ -217,4 +215,4 @@ def test_split_overlaps_hours_case2(self, testdata_stps_tpls_geolife_long):
 
         # no record has different days after the split
         day_diff = splitted["finished_at"].dt.day - splitted["started_at"].dt.day
-        assert (day_diff == 0).all()
\ No newline at end of file
+        assert (day_diff == 0).all()
diff --git a/tests/analysis/test_transport_mode_identification.py b/tests/analysis/test_transport_mode_identification.py
index 2a14316b..6c0029c4 100644
--- a/tests/analysis/test_transport_mode_identification.py
+++ b/tests/analysis/test_transport_mode_identification.py
@@ -13,65 +13,68 @@ def test_check_empty_dataframe(self):
         """Assert that the method does not work for empty DataFrames 
         (but that the rest works fine, e.g., method signature).
         """
-        tpls_file = os.path.join('tests', 'data', 'triplegs_transport_mode_identification.csv')
-        tpls = ti.read_triplegs_csv(tpls_file, sep=';', index_col="id")
+        tpls_file = os.path.join("tests", "data", "triplegs_transport_mode_identification.csv")
+        tpls = ti.read_triplegs_csv(tpls_file, sep=";", index_col="id")
         empty_frame = tpls[0:0]
         with pytest.raises(AssertionError):
-            empty_frame.as_triplegs.predict_transport_mode(method='simple-coarse')
+            empty_frame.as_triplegs.predict_transport_mode(method="simple-coarse")
 
     def test_simple_coarse_identification_no_crs(self):
         """Assert that the simple-coarse transport mode identification throws the correct 
         warning and and yields the correct results for WGS84.
         """
-        tpls_file = os.path.join('tests', 'data', 'triplegs_transport_mode_identification.csv')
-        tpls = ti.read_triplegs_csv(tpls_file, sep=';', index_col="id")
+        tpls_file = os.path.join("tests", "data", "triplegs_transport_mode_identification.csv")
+        tpls = ti.read_triplegs_csv(tpls_file, sep=";", index_col="id")
 
-        with pytest.warns(UserWarning, match='Your data is not projected. WGS84 is assumed and for length calculation'
-                                             ' the haversine distance is used'):
-            tpls_transport_mode = tpls.as_triplegs.predict_transport_mode(method='simple-coarse')
+        with pytest.warns(
+            UserWarning,
+            match="Your data is not projected. WGS84 is assumed and for length calculation"
+            " the haversine distance is used",
+        ):
+            tpls_transport_mode = tpls.as_triplegs.predict_transport_mode(method="simple-coarse")
 
-        assert tpls_transport_mode.iloc[0]['mode'] == 'slow_mobility'
-        assert tpls_transport_mode.iloc[1]['mode'] == 'motorized_mobility'
-        assert tpls_transport_mode.iloc[2]['mode'] == 'fast_mobility'
+        assert tpls_transport_mode.iloc[0]["mode"] == "slow_mobility"
+        assert tpls_transport_mode.iloc[1]["mode"] == "motorized_mobility"
+        assert tpls_transport_mode.iloc[2]["mode"] == "fast_mobility"
 
     def test_simple_coarse_identification_wgs_84(self):
         """Asserts the correct behaviour with data in wgs84."""
-        tpls_file = os.path.join('tests', 'data', 'triplegs_transport_mode_identification.csv')
-        tpls = ti.read_triplegs_csv(tpls_file, sep=';', index_col="id")
+        tpls_file = os.path.join("tests", "data", "triplegs_transport_mode_identification.csv")
+        tpls = ti.read_triplegs_csv(tpls_file, sep=";", index_col="id")
         tpls_2 = tpls.set_crs(epsg=4326)
-        tpls_transport_mode_2 = tpls_2.as_triplegs.predict_transport_mode(method='simple-coarse')
+        tpls_transport_mode_2 = tpls_2.as_triplegs.predict_transport_mode(method="simple-coarse")
 
-        assert tpls_transport_mode_2.iloc[0]['mode'] == 'slow_mobility'
-        assert tpls_transport_mode_2.iloc[1]['mode'] == 'motorized_mobility'
-        assert tpls_transport_mode_2.iloc[2]['mode'] == 'fast_mobility'
+        assert tpls_transport_mode_2.iloc[0]["mode"] == "slow_mobility"
+        assert tpls_transport_mode_2.iloc[1]["mode"] == "motorized_mobility"
+        assert tpls_transport_mode_2.iloc[2]["mode"] == "fast_mobility"
 
     def test_simple_coarse_identification_projected(self):
         """Asserts the correct behaviour with data in projected coordinate systems."""
-        tpls_file = os.path.join('tests', 'data', 'triplegs_transport_mode_identification.csv')
-        tpls = ti.read_triplegs_csv(tpls_file, sep=';', index_col="id")
+        tpls_file = os.path.join("tests", "data", "triplegs_transport_mode_identification.csv")
+        tpls = ti.read_triplegs_csv(tpls_file, sep=";", index_col="id")
         tpls_2 = tpls.set_crs(epsg=4326)
         tpls_3 = tpls_2.to_crs(epsg=2056)
-        tpls_transport_mode_3 = tpls_3.as_triplegs.predict_transport_mode(method='simple-coarse')
-        assert tpls_transport_mode_3.iloc[0]['mode'] == 'slow_mobility'
-        assert tpls_transport_mode_3.iloc[1]['mode'] == 'motorized_mobility'
-        assert tpls_transport_mode_3.iloc[2]['mode'] == 'fast_mobility'
+        tpls_transport_mode_3 = tpls_3.as_triplegs.predict_transport_mode(method="simple-coarse")
+        assert tpls_transport_mode_3.iloc[0]["mode"] == "slow_mobility"
+        assert tpls_transport_mode_3.iloc[1]["mode"] == "motorized_mobility"
+        assert tpls_transport_mode_3.iloc[2]["mode"] == "fast_mobility"
 
     def test_simple_coarse_identification_geographic(self):
         """Asserts that a warning is thrown if data in non-WGS geographic coordinate systems."""
-        tpls_file = os.path.join('tests', 'data', 'triplegs_transport_mode_identification.csv')
-        tpls = ti.read_triplegs_csv(tpls_file, sep=';', index_col="id")
+        tpls_file = os.path.join("tests", "data", "triplegs_transport_mode_identification.csv")
+        tpls = ti.read_triplegs_csv(tpls_file, sep=";", index_col="id")
         tpls_2 = tpls.set_crs(epsg=4326)
         tpls_4 = tpls_2.to_crs(epsg=4269)
         with pytest.warns(UserWarning):
-            tpls_4.as_triplegs.predict_transport_mode(method='simple-coarse')
+            tpls_4.as_triplegs.predict_transport_mode(method="simple-coarse")
 
     def test_check_categories(self):
         """Asserts the correct identification of valid category dictionaries."""
-        tpls_file = os.path.join('tests', 'data', 'triplegs_transport_mode_identification.csv')
-        tpls = ti.read_triplegs_csv(tpls_file, sep=';', index_col="id")
-        correct_dict = {2: 'cat1', 7: 'cat2', np.inf: 'cat3'}
+        tpls_file = os.path.join("tests", "data", "triplegs_transport_mode_identification.csv")
+        tpls = ti.read_triplegs_csv(tpls_file, sep=";", index_col="id")
+        correct_dict = {2: "cat1", 7: "cat2", np.inf: "cat3"}
 
         assert ti.analysis.transport_mode_identification.check_categories(correct_dict)
         with pytest.raises(ValueError):
-            incorrect_dict = {10: 'cat1', 5: 'cat2', np.inf: 'cat3'}
-            tpls.as_triplegs.predict_transport_mode(method='simple-coarse', categories=incorrect_dict)
+            incorrect_dict = {10: "cat1", 5: "cat2", np.inf: "cat3"}
+            tpls.as_triplegs.predict_transport_mode(method="simple-coarse", categories=incorrect_dict)
diff --git a/tests/examples/test_examples.py b/tests/examples/test_examples.py
index c378ddf0..3dbc29f6 100644
--- a/tests/examples/test_examples.py
+++ b/tests/examples/test_examples.py
@@ -3,9 +3,8 @@
 import os
 
 
-class Test_examples():
-
+class Test_examples:
     def test_example_preprocess_trajectories(self):
         """checks if the example 'preprocess_trajectories' runs without errors """
 
-        exec(open(os.path.join('examples', 'preprocess_trajectories.py')).read())
+        exec(open(os.path.join("examples", "preprocess_trajectories.py")).read())
diff --git a/tests/examples/test_tutorial.py b/tests/examples/test_tutorial.py
index 7810f911..23521ac2 100644
--- a/tests/examples/test_tutorial.py
+++ b/tests/examples/test_tutorial.py
@@ -7,28 +7,35 @@
 import subprocess
 import pytest
 
+
 @pytest.fixture(scope="function")
 def change_test_dir():
     """Change the current working directory, run the function and change back."""
-    os.chdir('./examples')
+    os.chdir("./examples")
     yield
-    os.chdir('..')
+    os.chdir("..")
+
 
-class Test_tutorial():
+class Test_tutorial:
     """Tests for tutorial jupyter notebook."""
-    
+
     def test_basic_tutorial(self, change_test_dir):
         """Test if the tutorial jupyter notebook runs without errors."""
         # convert the jupyter notebook to .py file
-        args = ["jupyter", "nbconvert", 
-                "./trackintel_basic_tutorial.ipynb", 
-                "--output", "tempFile", 
-                "--to", "script", "--execute", 
-                "--ExecutePreprocessor.timeout=60"]
-        
+        args = [
+            "jupyter",
+            "nbconvert",
+            "./trackintel_basic_tutorial.ipynb",
+            "--output",
+            "tempFile",
+            "--to",
+            "script",
+            "--execute",
+            "--ExecutePreprocessor.timeout=60",
+        ]
+
         # check if the .py file runs without error
         subprocess.check_call(args)
-        
-        # remove the .py file
-        os.remove('tempFile.py')
 
+        # remove the .py file
+        os.remove("tempFile.py")
diff --git a/tests/geogr/test_distances.py b/tests/geogr/test_distances.py
index 7531e5d6..588491f2 100644
--- a/tests/geogr/test_distances.py
+++ b/tests/geogr/test_distances.py
@@ -9,8 +9,12 @@
 from sklearn.metrics import pairwise_distances
 
 import trackintel as ti
-from trackintel.geogr.distances import meters_to_decimal_degrees, calculate_distance_matrix, \
-    calculate_haversine_length, _calculate_haversine_length_single
+from trackintel.geogr.distances import (
+    meters_to_decimal_degrees,
+    calculate_distance_matrix,
+    calculate_haversine_length,
+    _calculate_haversine_length_single,
+)
 
 
 @pytest.fixture
@@ -18,17 +22,18 @@ def gdf_lineStrings():
     """Construct a gdf that contains two LineStrings."""
     ls_short = LineString([(13.476808430, 48.573711823), (13.506804, 48.939008), (13.4664690, 48.5706414)])
     ls_long = LineString([(13.476808430, 48.573711823), (11.5675446, 48.1485459), (8.5067847, 47.4084269)])
-    
+
     a_list = [(0, ls_short), (1, ls_long)]
-    gdf = gpd.GeoDataFrame(a_list, columns=['id', 'geometry']).set_geometry('geometry')
-    gdf = gdf.set_crs('wgs84')
+    gdf = gpd.GeoDataFrame(a_list, columns=["id", "geometry"]).set_geometry("geometry")
+    gdf = gdf.set_crs("wgs84")
     return gdf
 
 
 @pytest.fixture
 def single_linestring():
     """Construct LineString that has ~1024 m in QGIS."""
-    return wkt.loads("""LineString(13.47671401745228259 
+    return wkt.loads(
+        """LineString(13.47671401745228259 
     48.57364142178052901, 13.47510901146785933
     48.5734004715611789, 13.47343656825720082
     48.57335585102421049, 13.47172366271079369
@@ -38,29 +43,32 @@ def single_linestring():
     48.57348971251707326, 13.46473716607271243
     48.57319521676494389, 13.46319959731452798
     48.57253482611510975, 13.46319959731452798
-    48.57253482611510975)""")
+    48.57253482611510975)"""
+    )
+
 
 @pytest.fixture
 def geolife_tpls():
     """Read geolife triplegs for testing."""
-    tpls_file = os.path.join('tests', 'data', 'geolife', 'geolife_triplegs.csv')
-    tpls = ti.read_triplegs_csv(tpls_file, tz='utc', index_col='id')
+    tpls_file = os.path.join("tests", "data", "geolife", "geolife_triplegs.csv")
+    tpls = ti.read_triplegs_csv(tpls_file, tz="utc", index_col="id")
     return tpls
 
+
 class TestCalculate_distance_matrix:
     """Tests for the calculate_distance_matrix() function."""
-    
+
     def test_shape_for_different_array_length(self):
-        spts_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-        spts = ti.read_staypoints_csv(spts_file, tz='utc', index_col='id')
+        spts_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+        spts = ti.read_staypoints_csv(spts_file, tz="utc", index_col="id")
 
         x = spts.iloc[0:5]
         y = spts.iloc[5:15]
 
-        d_euc1 = calculate_distance_matrix(X=x, Y=y, dist_metric='euclidean')
-        d_euc2 = calculate_distance_matrix(X=y, Y=x, dist_metric='euclidean')
-        d_hav1 = calculate_distance_matrix(X=x, Y=y, dist_metric='haversine')
-        d_hav2 = calculate_distance_matrix(X=y, Y=x, dist_metric='haversine')
+        d_euc1 = calculate_distance_matrix(X=x, Y=y, dist_metric="euclidean")
+        d_euc2 = calculate_distance_matrix(X=y, Y=x, dist_metric="euclidean")
+        d_hav1 = calculate_distance_matrix(X=x, Y=y, dist_metric="haversine")
+        d_hav2 = calculate_distance_matrix(X=y, Y=x, dist_metric="haversine")
 
         assert d_euc1.shape == d_hav1.shape == (5, 10)
         assert d_euc2.shape == d_hav2.shape == (10, 5)
@@ -68,25 +76,25 @@ def test_shape_for_different_array_length(self):
         assert np.isclose(0, np.sum(np.abs(d_hav1 - d_hav2.T)))
 
     def test_keyword_combinations(self):
-        spts_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-        spts = ti.read_staypoints_csv(spts_file, tz='utc', index_col='id')
+        spts_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+        spts = ti.read_staypoints_csv(spts_file, tz="utc", index_col="id")
 
         x = spts.iloc[0:5]
         y = spts.iloc[5:15]
 
-        _ = calculate_distance_matrix(X=x, Y=y, dist_metric='euclidean', n_jobs=-1)
-        _ = calculate_distance_matrix(X=y, Y=x, dist_metric='haversine', n_jobs=-1)
-        d_mink1 = calculate_distance_matrix(X=x, Y=x, dist_metric='minkowski', p=1)
-        d_mink2 = calculate_distance_matrix(X=x, Y=x, dist_metric='minkowski', p=2)
-        d_euc = calculate_distance_matrix(X=x, Y=x, dist_metric='euclidean')
+        _ = calculate_distance_matrix(X=x, Y=y, dist_metric="euclidean", n_jobs=-1)
+        _ = calculate_distance_matrix(X=y, Y=x, dist_metric="haversine", n_jobs=-1)
+        d_mink1 = calculate_distance_matrix(X=x, Y=x, dist_metric="minkowski", p=1)
+        d_mink2 = calculate_distance_matrix(X=x, Y=x, dist_metric="minkowski", p=2)
+        d_euc = calculate_distance_matrix(X=x, Y=x, dist_metric="euclidean")
 
         assert not np.array_equal(d_mink1, d_mink2)
         assert np.array_equal(d_euc, d_mink2)
 
     def test_compare_haversine_to_scikit_xy(self):
-        spts_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-        spts = ti.read_staypoints_csv(spts_file, tz='utc', index_col='id')
-        our_d_matrix = calculate_distance_matrix(X=spts, Y=spts, dist_metric='haversine')
+        spts_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+        spts = ti.read_staypoints_csv(spts_file, tz="utc", index_col="id")
+        our_d_matrix = calculate_distance_matrix(X=spts, Y=spts, dist_metric="haversine")
 
         x = spts.geometry.x.values
         y = spts.geometry.y.values
@@ -95,38 +103,38 @@ def test_compare_haversine_to_scikit_xy(self):
         y_rad = np.asarray([radians(_) for _ in y])
         yx = np.concatenate((y_rad.reshape(-1, 1), x_rad.reshape(-1, 1)), axis=1)
 
-        their_d_matrix = pairwise_distances(yx, metric='haversine') * 6371000
+        their_d_matrix = pairwise_distances(yx, metric="haversine") * 6371000
         assert np.allclose(np.abs(our_d_matrix - their_d_matrix), 0, atol=0.001)  # atol = 1mm
 
     def test_trajectory_distance_dtw(self, geolife_tpls):
         """Calculate Linestring length using dtw, single and multi core."""
         tpls = geolife_tpls
-        
-        D_all = calculate_distance_matrix(X=tpls.iloc[0:4], dist_metric='dtw', n_jobs=-1)
-        D_zero = calculate_distance_matrix(X=tpls.iloc[0:4], dist_metric='dtw', n_jobs=0)
-        
-        D_single = calculate_distance_matrix(X=tpls.iloc[0:4], dist_metric='dtw', n_jobs=1)
-        D_multi = calculate_distance_matrix(X=tpls.iloc[0:4], dist_metric='dtw', n_jobs=4)
+
+        D_all = calculate_distance_matrix(X=tpls.iloc[0:4], dist_metric="dtw", n_jobs=-1)
+        D_zero = calculate_distance_matrix(X=tpls.iloc[0:4], dist_metric="dtw", n_jobs=0)
+
+        D_single = calculate_distance_matrix(X=tpls.iloc[0:4], dist_metric="dtw", n_jobs=1)
+        D_multi = calculate_distance_matrix(X=tpls.iloc[0:4], dist_metric="dtw", n_jobs=4)
 
         assert np.isclose(np.sum(np.abs(D_single - D_multi)), 0)
         assert np.isclose(np.sum(np.abs(D_all - D_multi)), 0)
         assert np.isclose(np.sum(np.abs(D_zero - D_multi)), 0)
-        
+
     def test_trajectory_distance_frechet(self, geolife_tpls):
         """Calculate Linestring length using frechet, single and multi core."""
         tpls = geolife_tpls
-        
-        D_single = calculate_distance_matrix(X=tpls.iloc[0:4], dist_metric='frechet', n_jobs=1)
-        D_multi = calculate_distance_matrix(X=tpls.iloc[0:4], dist_metric='frechet', n_jobs=4)
+
+        D_single = calculate_distance_matrix(X=tpls.iloc[0:4], dist_metric="frechet", n_jobs=1)
+        D_multi = calculate_distance_matrix(X=tpls.iloc[0:4], dist_metric="frechet", n_jobs=4)
 
         assert np.isclose(np.sum(np.abs(D_single - D_multi)), 0)
 
     def test_trajectory_distance_via_accessor_x(self, geolife_tpls):
         """Calculate Linestring length using dtw via accessor."""
-        tpls = geolife_tpls 
+        tpls = geolife_tpls
 
-        D_single = tpls.iloc[0:4].as_triplegs.calculate_distance_matrix(dist_metric='dtw', n_jobs=1)
-        D_multi = tpls.iloc[0:4].as_triplegs.calculate_distance_matrix(dist_metric='dtw', n_jobs=4)
+        D_single = tpls.iloc[0:4].as_triplegs.calculate_distance_matrix(dist_metric="dtw", n_jobs=1)
+        D_multi = tpls.iloc[0:4].as_triplegs.calculate_distance_matrix(dist_metric="dtw", n_jobs=4)
 
         assert np.isclose(np.sum(np.abs(D_single - D_multi)), 0)
 
@@ -137,39 +145,42 @@ def test_trajectory_distance_via_accessor_xy(self, geolife_tpls):
         x = tpls.iloc[0:2]
         y = tpls.iloc[4:8]
 
-        D_single = x.as_triplegs.calculate_distance_matrix(Y=y, dist_metric='dtw', n_jobs=1)
-        D_multi = x.as_triplegs.calculate_distance_matrix(Y=y, dist_metric='dtw', n_jobs=4)
+        D_single = x.as_triplegs.calculate_distance_matrix(Y=y, dist_metric="dtw", n_jobs=1)
+        D_multi = x.as_triplegs.calculate_distance_matrix(Y=y, dist_metric="dtw", n_jobs=4)
 
         assert np.isclose(np.sum(np.abs(D_single - D_multi)), 0)
-        
+
     def test_trajectory_distance_error(self, geolife_tpls):
         """Test if the an error is raised when passing unknown 'dist_metric'."""
         tpls = geolife_tpls
-        
+
         with pytest.raises(AttributeError):
             tpls.iloc[0:4].as_triplegs.calculate_distance_matrix(dist_metric=12345, n_jobs=1)
         with pytest.raises(AttributeError):
             tpls.iloc[0:4].as_triplegs.calculate_distance_matrix(dist_metric="random", n_jobs=1)
-    
+
     def test_distance_error(self, single_linestring):
         """Test if the an error is raised when wrong geometry is passed."""
         # construct a gdf with two MultiLineStrings
         multi = MultiLineString([single_linestring, single_linestring])
         a_list = [(0, multi), (1, multi)]
-        gdf = gpd.GeoDataFrame(a_list, columns=['id', 'geometry']).set_geometry('geometry')
-        gdf = gdf.set_crs('wgs84')
-        
+        gdf = gpd.GeoDataFrame(a_list, columns=["id", "geometry"]).set_geometry("geometry")
+        gdf = gdf.set_crs("wgs84")
+
         with pytest.raises(AttributeError):
-            calculate_distance_matrix(X=gdf, dist_metric='dtw', n_jobs=1)
+            calculate_distance_matrix(X=gdf, dist_metric="dtw", n_jobs=1)
+
 
 class TestMetersToDecimalDegrees:
     """Tests for the meters_to_decimal_degrees() function."""
-    
+
     def test_meters_to_decimal_degrees(self):
-        input_result_dict = {1.0: {0: 111320, 23: 102470, 45: 78710, 67: 43496},
-                             0.1: {0: 11132, 23: 10247, 45: 7871, 67: 4349.6},
-                             0.01: {0: 1113.2, 23: 1024.7, 45: 787.1, 67: 434.96},
-                             0.001: {0: 111.32, 23: 102.47, 45: 78.71, 67: 43.496}}
+        input_result_dict = {
+            1.0: {0: 111320, 23: 102470, 45: 78710, 67: 43496},
+            0.1: {0: 11132, 23: 10247, 45: 7871, 67: 4349.6},
+            0.01: {0: 1113.2, 23: 1024.7, 45: 787.1, 67: 434.96},
+            0.001: {0: 111.32, 23: 102.47, 45: 78.71, 67: 43.496},
+        }
 
         for degree, lat_output in input_result_dict.items():
             for lat, meters in lat_output.items():
@@ -179,7 +190,7 @@ def test_meters_to_decimal_degrees(self):
 
 class Testcalc_haversine_length:
     """Tests for the calculate_haversine_length() function."""
-    
+
     def test_length(self, gdf_lineStrings):
         """Check if `calculate_haversine_length` runs without errors."""
         length = calculate_haversine_length(gdf_lineStrings)
@@ -189,7 +200,7 @@ def test_length(self, gdf_lineStrings):
 
 class Test_calculate_haversine_length_single:
     """Tests for the _calculate_haversine_length_single() function."""
-    
+
     def Test_length(self, single_linestring):
         """Check if the length of a longer linestring is calculated correctly up to some meters."""
         length = _calculate_haversine_length_single(single_linestring)
diff --git a/tests/geogr/test_point_distances.py b/tests/geogr/test_point_distances.py
index ffa119bf..22bf39e8 100644
--- a/tests/geogr/test_point_distances.py
+++ b/tests/geogr/test_point_distances.py
@@ -20,22 +20,23 @@ def test_haversine_dist(self):
         """
 
         # {haversine-distance in meters[longitude_P1, latitudes_P1, longitude_P2, latitudes_P2]}
-        input_latlng = {18749: [8.5, 47.3, 8.7, 47.2],  # Source: see Information to function
-                        5897658.289: [-0.116773, 51.510357, -77.009003, 38.889931],
-
-                        3780627: [0.0, 4.0, 0.0, 38],
-                        # Source for next lines: self-computation with formula from link above
-                        2306879.363: [-7.345, -7.345, 7.345, 7.345],
-                        13222121.519: [-0.118746, 73.998, -120.947783, -21.4783],
-                        785767.221: [50, 0, 45, 5]}
+        input_latlng = {
+            18749: [8.5, 47.3, 8.7, 47.2],  # Source: see Information to function
+            5897658.289: [-0.116773, 51.510357, -77.009003, 38.889931],
+            3780627: [0.0, 4.0, 0.0, 38],
+            # Source for next lines: self-computation with formula from link above
+            2306879.363: [-7.345, -7.345, 7.345, 7.345],
+            13222121.519: [-0.118746, 73.998, -120.947783, -21.4783],
+            785767.221: [50, 0, 45, 5],
+        }
 
         for haversine, latlng in input_latlng.items():
             haversine_output = haversine_dist(latlng[0], latlng[1], latlng[2], latlng[3])
             assert np.isclose(haversine_output, haversine, atol=0.1)
 
     def test_haversine_vectorized(self):
-        stps_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-        stps = ti.read_staypoints_csv(stps_file, tz='utc', index_col='id')
+        stps_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+        stps = ti.read_staypoints_csv(stps_file, tz="utc", index_col="id")
         x = stps.geometry.x.values
         y = stps.geometry.y.values
 
@@ -57,8 +58,7 @@ def test_haversine_vectorized(self):
 
         D_theirs = haversine_distances(yx, yx) * 6371000
         d_theirs = D_theirs[ix_1, ix_2]
-        assert np.sum(np.abs(d_ours - d_theirs)) < 0.01 #  1cm for 58 should be good enough
-
+        assert np.sum(np.abs(d_ours - d_theirs)) < 0.01  #  1cm for 58 should be good enough
 
     def test_example_from_sklean(self):
 
diff --git a/tests/io/test_dataset_reader.py b/tests/io/test_dataset_reader.py
index fda22d52..bc030e00 100644
--- a/tests/io/test_dataset_reader.py
+++ b/tests/io/test_dataset_reader.py
@@ -11,15 +11,14 @@
 
 @pytest.fixture
 def read_geolife_modes():
-    return read_geolife(os.path.join('tests', 'data', 'geolife_modes'))
+    return read_geolife(os.path.join("tests", "data", "geolife_modes"))
+
 
 @pytest.fixture
 def read_geolife_triplegs_with_modes(read_geolife_modes):
     pfs, labels = read_geolife_modes
-    pfs, spts = pfs.as_positionfixes.generate_staypoints(method='sliding',
-                                                         dist_threshold=25,
-                                                         time_threshold=5)
-    _, tpls = pfs.as_positionfixes.generate_triplegs(spts, method='between_staypoints')
+    pfs, spts = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=25, time_threshold=5)
+    _, tpls = pfs.as_positionfixes.generate_triplegs(spts, method="between_staypoints")
 
     return tpls, labels
 
@@ -36,20 +35,22 @@ def matching_data():
     """
     one_hour = datetime.timedelta(hours=1)
     one_min = datetime.timedelta(minutes=1)
-    time_1 = pd.Timestamp("1970-01-01", tz='utc')
+    time_1 = pd.Timestamp("1970-01-01", tz="utc")
 
-    triplegs = [{'id': 0, 'started_at': time_1, 'finished_at': time_1 + one_hour},
-                {'id': 1, 'started_at': time_1 + 2 * one_hour, 'finished_at': time_1 + 3 * one_hour},
-                {'id': 2, 'started_at': time_1 + 4 * one_hour, 'finished_at': time_1 + 5 * one_hour},
-                {'id': 3, 'started_at': time_1 + 6 * one_hour - one_min,
-                 'finished_at': time_1 + 7 * one_hour + one_min}]
+    triplegs = [
+        {"id": 0, "started_at": time_1, "finished_at": time_1 + one_hour},
+        {"id": 1, "started_at": time_1 + 2 * one_hour, "finished_at": time_1 + 3 * one_hour},
+        {"id": 2, "started_at": time_1 + 4 * one_hour, "finished_at": time_1 + 5 * one_hour},
+        {"id": 3, "started_at": time_1 + 6 * one_hour - one_min, "finished_at": time_1 + 7 * one_hour + one_min},
+    ]
 
-    labels_raw = [{'id': 0, 'started_at': time_1 + one_min, 'finished_at': time_1 + 4 * one_hour + one_min,
-                   'mode': 'walk'},
-                  {'id': 1, 'started_at': time_1 + 6 * one_hour, 'finished_at': time_1 + 7 * one_hour, 'mode': 'bike'}]
+    labels_raw = [
+        {"id": 0, "started_at": time_1 + one_min, "finished_at": time_1 + 4 * one_hour + one_min, "mode": "walk"},
+        {"id": 1, "started_at": time_1 + 6 * one_hour, "finished_at": time_1 + 7 * one_hour, "mode": "bike"},
+    ]
 
-    triplegs = pd.DataFrame(triplegs).set_index('id')
-    labels_raw = pd.DataFrame(labels_raw).set_index('id')
+    triplegs = pd.DataFrame(triplegs).set_index("id")
+    labels_raw = pd.DataFrame(labels_raw).set_index("id")
 
     return triplegs, labels_raw
 
@@ -63,15 +64,16 @@ def impossible_matching_data():
 
     one_hour = datetime.timedelta(hours=1)
     one_min = datetime.timedelta(minutes=1)
-    time_1 = pd.Timestamp("1970-01-01", tz='utc')
-    time_2 = pd.Timestamp("1980-01-01", tz='utc')
+    time_1 = pd.Timestamp("1970-01-01", tz="utc")
+    time_2 = pd.Timestamp("1980-01-01", tz="utc")
 
-    triplegs = [{'id': 0, 'started_at': time_1, 'finished_at': time_1 + one_hour}]
-    labels_raw = [{'id': 0, 'started_at': time_2 + one_min, 'finished_at': time_2 + 4 * one_hour + one_min,
-                   'mode': 'walk'}]
+    triplegs = [{"id": 0, "started_at": time_1, "finished_at": time_1 + one_hour}]
+    labels_raw = [
+        {"id": 0, "started_at": time_2 + one_min, "finished_at": time_2 + 4 * one_hour + one_min, "mode": "walk"}
+    ]
 
-    triplegs = pd.DataFrame(triplegs).set_index('id')
-    labels_raw = pd.DataFrame(labels_raw).set_index('id')
+    triplegs = pd.DataFrame(triplegs).set_index("id")
+    labels_raw = pd.DataFrame(labels_raw).set_index("id")
 
     return triplegs, labels_raw
 
@@ -79,17 +81,17 @@ def impossible_matching_data():
 class TestReadGeolife:
     def test_loop_read(self):
         """Use read_geolife reader, store posfix as .csv, load them again."""
-        pfs, _ = read_geolife(os.path.join('tests', 'data', 'geolife'))
-        tmp_file = os.path.join('tests', 'data', 'positionfixes_test.csv')
+        pfs, _ = read_geolife(os.path.join("tests", "data", "geolife"))
+        tmp_file = os.path.join("tests", "data", "positionfixes_test.csv")
         pfs.as_positionfixes.to_csv(tmp_file)
-        pfs2 = ti.read_positionfixes_csv(tmp_file, index_col='id')[pfs.columns]
+        pfs2 = ti.read_positionfixes_csv(tmp_file, index_col="id")[pfs.columns]
         os.remove(tmp_file)
         assert np.isclose(0, (pfs.lat - pfs2.lat).abs().sum())
 
     def test_label_reading(self):
         """test data types of the labels returned by read_geolife"""
 
-        pfs, labels = read_geolife(os.path.join('tests', 'data', 'geolife_modes'))
+        pfs, labels = read_geolife(os.path.join("tests", "data", "geolife_modes"))
         # the output is a dictionary
         assert isinstance(labels, dict)
 
@@ -101,7 +103,7 @@ def test_label_reading(self):
     def test_unavailable_label_reading(self):
         """test data types of the labels returned by read_geolife from a dictionary without label files"""
 
-        pfs, labels = read_geolife(os.path.join('tests', 'data', 'geolife_long'))
+        pfs, labels = read_geolife(os.path.join("tests", "data", "geolife_long"))
 
         # the output is a dictionary
         assert isinstance(labels, dict)
@@ -112,8 +114,8 @@ def test_unavailable_label_reading(self):
 
     def test_wrong_folder_name(self):
         """Check if invalid folder names raise an exception"""
-        geolife_path = os.path.join('tests', 'data', 'geolife')
-        temp_dir = os.path.join(geolife_path, '123 - invalid folder ()%')
+        geolife_path = os.path.join("tests", "data", "geolife")
+        temp_dir = os.path.join(geolife_path, "123 - invalid folder ()%")
         os.mkdir(temp_dir)
 
         try:
@@ -124,7 +126,6 @@ def test_wrong_folder_name(self):
 
 
 class TestGeolife_add_modes_to_triplegs:
-
     def test_geolife_mode_matching(self, read_geolife_triplegs_with_modes):
         """Test that the matching runs with geolife.
         We only check that there are nan's and non nan's in the results."""
@@ -132,49 +133,48 @@ def test_geolife_mode_matching(self, read_geolife_triplegs_with_modes):
         tpls, labels = read_geolife_triplegs_with_modes
         tpls = geolife_add_modes_to_triplegs(tpls, labels)
 
-        assert pd.isna(tpls['mode']).any()
-        assert (~pd.isna(tpls['mode'])).any()
-        assert pd.isna(tpls['label_id']).any()
-        assert (~pd.isna(tpls['label_id'])).any()
+        assert pd.isna(tpls["mode"]).any()
+        assert (~pd.isna(tpls["mode"])).any()
+        assert pd.isna(tpls["label_id"]).any()
+        assert (~pd.isna(tpls["label_id"])).any()
 
-        assert 'started_at_s' not in tpls.columns
+        assert "started_at_s" not in tpls.columns
 
     def test_mode_matching(self, matching_data):
         # bring label data into right format. All labels belong to the same user
         tpls, labels_raw = matching_data
-        tpls['user_id'] = 0
+        tpls["user_id"] = 0
         labels = {0: labels_raw}
 
         tpls = geolife_add_modes_to_triplegs(tpls, labels)
 
-        assert tpls.loc[0, 'mode'] == 'walk' and tpls.loc[0, 'label_id'] == 0
-        assert tpls.loc[1, 'mode'] == 'walk' and tpls.loc[1, 'label_id'] == 0
-        assert pd.isna(tpls.loc[2, 'mode']) and pd.isna(tpls.loc[2, 'label_id'])
-        assert tpls.loc[3, 'mode'] == 'bike' and tpls.loc[3, 'label_id'] == 1
+        assert tpls.loc[0, "mode"] == "walk" and tpls.loc[0, "label_id"] == 0
+        assert tpls.loc[1, "mode"] == "walk" and tpls.loc[1, "label_id"] == 0
+        assert pd.isna(tpls.loc[2, "mode"]) and pd.isna(tpls.loc[2, "label_id"])
+        assert tpls.loc[3, "mode"] == "bike" and tpls.loc[3, "label_id"] == 1
 
     def test_mode_matching_multi_user(self, matching_data):
         # bring label data into right format. All labels belong to the same user but we add an empty DataFrame with
         # labels in the end
 
         tpls, labels_raw = matching_data
-        tpls['user_id'] = 0
-        labels = {0: labels_raw,
-                  1: pd.DataFrame(columns=labels_raw.columns)}
+        tpls["user_id"] = 0
+        labels = {0: labels_raw, 1: pd.DataFrame(columns=labels_raw.columns)}
 
-        tpls.loc[1, 'user_id'] = 1
+        tpls.loc[1, "user_id"] = 1
 
         tpls = geolife_add_modes_to_triplegs(tpls, labels)
 
-        assert tpls.loc[0, 'mode'] == 'walk' and tpls.loc[0, 'label_id'] == 0
-        assert pd.isna(tpls.loc[1, 'mode']) and pd.isna(tpls.loc[1, 'label_id'])
-        assert pd.isna(tpls.loc[2, 'mode']) and pd.isna(tpls.loc[2, 'label_id'])
-        assert tpls.loc[3, 'mode'] == 'bike' and tpls.loc[3, 'label_id'] == 1
+        assert tpls.loc[0, "mode"] == "walk" and tpls.loc[0, "label_id"] == 0
+        assert pd.isna(tpls.loc[1, "mode"]) and pd.isna(tpls.loc[1, "label_id"])
+        assert pd.isna(tpls.loc[2, "mode"]) and pd.isna(tpls.loc[2, "label_id"])
+        assert tpls.loc[3, "mode"] == "bike" and tpls.loc[3, "label_id"] == 1
 
     def test_impossible_matching(self, impossible_matching_data):
         # bring label data into right format. All labels belong to the same user
         tpls, labels_raw = impossible_matching_data
-        tpls['user_id'] = 0
+        tpls["user_id"] = 0
         labels = {0: labels_raw}
 
         tpls = geolife_add_modes_to_triplegs(tpls, labels)
-        assert pd.isna(tpls.iloc[0]['mode'])
+        assert pd.isna(tpls.iloc[0]["mode"])
diff --git a/tests/io/test_file.py b/tests/io/test_file.py
index d324e1f5..b9d6a0c0 100644
--- a/tests/io/test_file.py
+++ b/tests/io/test_file.py
@@ -6,70 +6,69 @@
 import trackintel as ti
 
 
-
 class TestPositionfixes:
     """Test for 'read_positionfixes_csv' and 'write_positionfixes_csv' functions."""
-    
+
     def test_from_to_csv(self):
         """Test basic reading and writing functions."""
-        orig_file = os.path.join('tests', 'data', 'positionfixes.csv')
-        mod_file = os.path.join('tests', 'data', 'positionfixes_mod_columns.csv')
-        tmp_file = os.path.join('tests', 'data', 'positionfixes_test.csv')
-
-        pfs = ti.read_positionfixes_csv(orig_file, sep=';', index_col="id")
-        
-        column_mapping = {'lat': 'latitude', 'lon': 'longitude', 'time': 'tracked_at'}
-        mod_pfs = ti.read_positionfixes_csv(mod_file, sep=';', index_col="id", columns=column_mapping)
+        orig_file = os.path.join("tests", "data", "positionfixes.csv")
+        mod_file = os.path.join("tests", "data", "positionfixes_mod_columns.csv")
+        tmp_file = os.path.join("tests", "data", "positionfixes_test.csv")
+
+        pfs = ti.read_positionfixes_csv(orig_file, sep=";", index_col="id")
+
+        column_mapping = {"lat": "latitude", "lon": "longitude", "time": "tracked_at"}
+        mod_pfs = ti.read_positionfixes_csv(mod_file, sep=";", index_col="id", columns=column_mapping)
         assert mod_pfs.equals(pfs)
-        pfs['tracked_at'] = pfs['tracked_at'].apply(lambda d: d.isoformat().replace('+00:00', 'Z'))
-        
-        columns = ['user_id', 'tracked_at', 'latitude', 'longitude', 'elevation', 'accuracy']
-        pfs.as_positionfixes.to_csv(tmp_file, sep=';', columns=columns)
+        pfs["tracked_at"] = pfs["tracked_at"].apply(lambda d: d.isoformat().replace("+00:00", "Z"))
+
+        columns = ["user_id", "tracked_at", "latitude", "longitude", "elevation", "accuracy"]
+        pfs.as_positionfixes.to_csv(tmp_file, sep=";", columns=columns)
         assert filecmp.cmp(orig_file, tmp_file, shallow=False)
         os.remove(tmp_file)
 
     def test_set_crs(self):
         """Test setting the crs when reading."""
-        file = os.path.join('tests', 'data', 'positionfixes.csv')
-        pfs = ti.read_positionfixes_csv(file, sep=';', index_col="id")
+        file = os.path.join("tests", "data", "positionfixes.csv")
+        pfs = ti.read_positionfixes_csv(file, sep=";", index_col="id")
         assert pfs.crs is None
-        
+
         crs = "EPSG:2056"
-        pfs = ti.read_positionfixes_csv(file, sep=';', index_col="id", crs=crs)
+        pfs = ti.read_positionfixes_csv(file, sep=";", index_col="id", crs=crs)
         assert pfs.crs == crs
-        
+
     def test_set_datatime_tz(self):
         """Test setting the timezone infomation when reading."""
         # check if tz is added to the datatime column
-        file = os.path.join('tests', 'data', 'positionfixes.csv')
-        pfs = ti.read_positionfixes_csv(file, sep=';', index_col="id")
+        file = os.path.join("tests", "data", "positionfixes.csv")
+        pfs = ti.read_positionfixes_csv(file, sep=";", index_col="id")
         assert pd.api.types.is_datetime64tz_dtype(pfs["tracked_at"])
-        
+
         # check if a timezone will be set after manually deleting the timezone
-        pfs['tracked_at'] = pfs['tracked_at'].dt.tz_localize(None)
+        pfs["tracked_at"] = pfs["tracked_at"].dt.tz_localize(None)
         assert not pd.api.types.is_datetime64tz_dtype(pfs["tracked_at"])
-        tmp_file = os.path.join('tests', 'data', 'positionfixes_test.csv')
-        pfs.as_positionfixes.to_csv(tmp_file, sep=';')
-        pfs = ti.read_positionfixes_csv(tmp_file, sep=';', index_col="id", tz = 'utc')
-        
+        tmp_file = os.path.join("tests", "data", "positionfixes_test.csv")
+        pfs.as_positionfixes.to_csv(tmp_file, sep=";")
+        pfs = ti.read_positionfixes_csv(tmp_file, sep=";", index_col="id", tz="utc")
+
         assert pd.api.types.is_datetime64tz_dtype(pfs["tracked_at"])
-        
+
         # check if a warning is raised if 'tz' is not provided
         with pytest.warns(UserWarning):
-            ti.read_positionfixes_csv(tmp_file, sep=';', index_col="id")
-        
+            ti.read_positionfixes_csv(tmp_file, sep=";", index_col="id")
+
         os.remove(tmp_file)
-        
+
     def test_set_index_warning(self):
         """Test if a warning is raised when not parsing the index_col argument."""
-        file = os.path.join('tests', 'data', 'positionfixes.csv')
+        file = os.path.join("tests", "data", "positionfixes.csv")
         with pytest.warns(UserWarning):
-            ti.read_positionfixes_csv(file, sep=';')
+            ti.read_positionfixes_csv(file, sep=";")
 
     def test_set_index(self):
         """Test if `index_col` can be set."""
-        file = os.path.join('tests', 'data', 'positionfixes.csv')
-        ind_name = 'id'
+        file = os.path.join("tests", "data", "positionfixes.csv")
+        ind_name = "id"
         pfs = ti.read_positionfixes_csv(file, sep=";", index_col=ind_name)
         assert pfs.index.name == ind_name
         pfs = ti.read_positionfixes_csv(file, sep=";", index_col=None)
@@ -79,70 +78,71 @@ def test_from_to_postgis(self):
         # TODO Implement some tests for PostGIS.
         pass
 
+
 class TestTriplegs:
     """Test for 'read_triplegs_csv' and 'write_triplegs_csv' functions."""
-    
+
     def test_from_to_csv(self):
         """Test basic reading and writing functions."""
-        orig_file = os.path.join('tests', 'data', 'triplegs.csv')
-        mod_file = os.path.join('tests', 'data', 'triplegs_mod_columns.csv')
-        tmp_file = os.path.join('tests', 'data', 'triplegs_test.csv')
-        tpls = ti.read_triplegs_csv(orig_file, sep=';', tz='utc', index_col="id")
-        
-        column_mapping = {'start_time': 'started_at', 'end_time': 'finished_at', 'tripleg': 'geom'}
-        mod_tpls = ti.read_triplegs_csv(mod_file, sep=';', columns=column_mapping, index_col="id")
-        
+        orig_file = os.path.join("tests", "data", "triplegs.csv")
+        mod_file = os.path.join("tests", "data", "triplegs_mod_columns.csv")
+        tmp_file = os.path.join("tests", "data", "triplegs_test.csv")
+        tpls = ti.read_triplegs_csv(orig_file, sep=";", tz="utc", index_col="id")
+
+        column_mapping = {"start_time": "started_at", "end_time": "finished_at", "tripleg": "geom"}
+        mod_tpls = ti.read_triplegs_csv(mod_file, sep=";", columns=column_mapping, index_col="id")
+
         assert mod_tpls.equals(tpls)
-        tpls['started_at'] = tpls['started_at'].apply(lambda d: d.isoformat().replace('+00:00', 'Z'))
-        tpls['finished_at'] = tpls['finished_at'].apply(lambda d: d.isoformat().replace('+00:00', 'Z'))
+        tpls["started_at"] = tpls["started_at"].apply(lambda d: d.isoformat().replace("+00:00", "Z"))
+        tpls["finished_at"] = tpls["finished_at"].apply(lambda d: d.isoformat().replace("+00:00", "Z"))
 
-        columns = ['user_id', 'started_at', 'finished_at', 'geom']
-        tpls.as_triplegs.to_csv(tmp_file, sep=';', columns=columns)
+        columns = ["user_id", "started_at", "finished_at", "geom"]
+        tpls.as_triplegs.to_csv(tmp_file, sep=";", columns=columns)
         assert filecmp.cmp(orig_file, tmp_file, shallow=False)
         os.remove(tmp_file)
 
     def test_set_crs(self):
         """Test setting the crs when reading."""
-        file = os.path.join('tests', 'data', 'triplegs.csv')
+        file = os.path.join("tests", "data", "triplegs.csv")
         crs = "EPSG:2056"
-        tpls = ti.read_triplegs_csv(file, sep=';', tz='utc', index_col="id")
+        tpls = ti.read_triplegs_csv(file, sep=";", tz="utc", index_col="id")
         assert tpls.crs is None
-        
-        tpls = ti.read_triplegs_csv(file, sep=';', tz='utc', index_col="id", crs=crs)
+
+        tpls = ti.read_triplegs_csv(file, sep=";", tz="utc", index_col="id", crs=crs)
         assert tpls.crs == crs
-        
+
     def test_set_datatime_tz(self):
         """Test setting the timezone infomation when reading."""
         # check if tz is added to the datatime column
-        file = os.path.join('tests', 'data', 'triplegs.csv')
-        tpls = ti.read_triplegs_csv(file, sep=';', index_col="id")
+        file = os.path.join("tests", "data", "triplegs.csv")
+        tpls = ti.read_triplegs_csv(file, sep=";", index_col="id")
         assert pd.api.types.is_datetime64tz_dtype(tpls["started_at"])
-        
+
         # check if a timezone will be set after manually deleting the timezone
-        tpls['started_at'] = tpls['started_at'].dt.tz_localize(None)
+        tpls["started_at"] = tpls["started_at"].dt.tz_localize(None)
         assert not pd.api.types.is_datetime64tz_dtype(tpls["started_at"])
-        tmp_file = os.path.join('tests', 'data', 'triplegs_test.csv')
-        tpls.as_triplegs.to_csv(tmp_file, sep=';')
-        tpls = ti.read_triplegs_csv(tmp_file, sep=';', index_col="id", tz = 'utc')
-        
+        tmp_file = os.path.join("tests", "data", "triplegs_test.csv")
+        tpls.as_triplegs.to_csv(tmp_file, sep=";")
+        tpls = ti.read_triplegs_csv(tmp_file, sep=";", index_col="id", tz="utc")
+
         assert pd.api.types.is_datetime64tz_dtype(tpls["started_at"])
-        
+
         # check if a warning is raised if 'tz' is not provided
         with pytest.warns(UserWarning):
-            ti.read_triplegs_csv(tmp_file, sep=';', index_col="id")
-        
+            ti.read_triplegs_csv(tmp_file, sep=";", index_col="id")
+
         os.remove(tmp_file)
-        
+
     def test_set_index_warning(self):
         """Test if a warning is raised when not parsing the index_col argument."""
-        file = os.path.join('tests', 'data', 'triplegs.csv')
+        file = os.path.join("tests", "data", "triplegs.csv")
         with pytest.warns(UserWarning):
-            ti.read_triplegs_csv(file, sep=';')
+            ti.read_triplegs_csv(file, sep=";")
 
     def test_set_index(self):
         """Test if `index_col` can be set."""
-        file = os.path.join('tests', 'data', 'triplegs.csv')
-        ind_name = 'id'
+        file = os.path.join("tests", "data", "triplegs.csv")
+        ind_name = "id"
         pfs = ti.read_triplegs_csv(file, sep=";", index_col=ind_name)
         assert pfs.index.name == ind_name
         pfs = ti.read_triplegs_csv(file, sep=";", index_col=None)
@@ -151,69 +151,69 @@ def test_set_index(self):
     def test_from_to_postgis(self):
         # TODO Implement some tests for PostGIS.
         pass
-    
-    
+
+
 class TestStaypoints:
     """Test for 'read_staypoints_csv' and 'write_staypoints_csv' functions."""
-    
+
     def test_from_to_csv(self):
         """Test basic reading and writing functions."""
-        orig_file = os.path.join('tests', 'data', 'staypoints.csv')
-        mod_file = os.path.join('tests', 'data', 'staypoints_mod_columns.csv')
-        tmp_file = os.path.join('tests', 'data', 'staypoints_test.csv')
-        stps = ti.read_staypoints_csv(orig_file, sep=';', tz='utc', index_col="id")
-        mod_stps = ti.read_staypoints_csv(mod_file, columns={'User': 'user_id'}, sep=';', index_col="id")
+        orig_file = os.path.join("tests", "data", "staypoints.csv")
+        mod_file = os.path.join("tests", "data", "staypoints_mod_columns.csv")
+        tmp_file = os.path.join("tests", "data", "staypoints_test.csv")
+        stps = ti.read_staypoints_csv(orig_file, sep=";", tz="utc", index_col="id")
+        mod_stps = ti.read_staypoints_csv(mod_file, columns={"User": "user_id"}, sep=";", index_col="id")
         assert mod_stps.equals(stps)
-        stps['started_at'] = stps['started_at'].apply(lambda d: d.isoformat().replace('+00:00', 'Z'))
-        stps['finished_at'] = stps['finished_at'].apply(lambda d: d.isoformat().replace('+00:00', 'Z'))
-        
-        columns = ['user_id', 'started_at', 'finished_at', 'elevation', 'geom']
-        stps.as_staypoints.to_csv(tmp_file, sep=';', columns=columns)
+        stps["started_at"] = stps["started_at"].apply(lambda d: d.isoformat().replace("+00:00", "Z"))
+        stps["finished_at"] = stps["finished_at"].apply(lambda d: d.isoformat().replace("+00:00", "Z"))
+
+        columns = ["user_id", "started_at", "finished_at", "elevation", "geom"]
+        stps.as_staypoints.to_csv(tmp_file, sep=";", columns=columns)
         assert filecmp.cmp(orig_file, tmp_file, shallow=False)
         os.remove(tmp_file)
 
     def test_set_crs(self):
         """Test setting the crs when reading."""
-        file = os.path.join('tests', 'data', 'staypoints.csv')
+        file = os.path.join("tests", "data", "staypoints.csv")
         crs = "EPSG:2056"
-        stps = ti.read_staypoints_csv(file, sep=';', tz='utc', index_col="id")
+        stps = ti.read_staypoints_csv(file, sep=";", tz="utc", index_col="id")
         assert stps.crs is None
-        
-        stps = ti.read_staypoints_csv(file, sep=';', tz='utc', index_col="id", crs=crs)
+
+        stps = ti.read_staypoints_csv(file, sep=";", tz="utc", index_col="id", crs=crs)
         assert stps.crs == crs
-        
+
     def test_set_datatime_tz(self):
         """Test setting the timezone infomation when reading."""
         # check if tz is added to the datatime column
-        file = os.path.join('tests', 'data', 'staypoints.csv')
-        stps = ti.read_staypoints_csv(file, sep=';', index_col="id")
+        file = os.path.join("tests", "data", "staypoints.csv")
+        stps = ti.read_staypoints_csv(file, sep=";", index_col="id")
         assert pd.api.types.is_datetime64tz_dtype(stps["started_at"])
-        
+
         # check if a timezone will be set after manually deleting the timezone
-        stps['started_at'] = stps['started_at'].dt.tz_localize(None)
+        stps["started_at"] = stps["started_at"].dt.tz_localize(None)
         assert not pd.api.types.is_datetime64tz_dtype(stps["started_at"])
-        tmp_file = os.path.join('tests', 'data', 'staypoints_test.csv')
-        stps.as_staypoints.to_csv(tmp_file, sep=';')
-        stps = ti.read_staypoints_csv(tmp_file, sep=';', index_col="id", tz = 'utc')
-        
+        tmp_file = os.path.join("tests", "data", "staypoints_test.csv")
+        stps.as_staypoints.to_csv(tmp_file, sep=";")
+        stps = ti.read_staypoints_csv(tmp_file, sep=";", index_col="id", tz="utc")
+
         assert pd.api.types.is_datetime64tz_dtype(stps["started_at"])
-        
+
         # check if a warning is raised if 'tz' is not provided
         with pytest.warns(UserWarning):
-            ti.read_staypoints_csv(tmp_file, sep=';', index_col="id")
-        
+            ti.read_staypoints_csv(tmp_file, sep=";", index_col="id")
+
         os.remove(tmp_file)
-        
+
     def test_set_index_warning(self):
         """Test if a warning is raised when not parsing the index_col argument."""
-        file = os.path.join('tests', 'data', 'staypoints.csv')
+        file = os.path.join("tests", "data", "staypoints.csv")
         with pytest.warns(UserWarning):
-            ti.read_staypoints_csv(file, sep=';')
+            ti.read_staypoints_csv(file, sep=";")
 
     def test_set_index(self):
         """Test if `index_col` can be set."""
-        file = os.path.join('tests', 'data', 'staypoints.csv')
-        ind_name = 'id'
+        file = os.path.join("tests", "data", "staypoints.csv")
+        ind_name = "id"
         pfs = ti.read_staypoints_csv(file, sep=";", index_col=ind_name)
         assert pfs.index.name == ind_name
         pfs = ti.read_staypoints_csv(file, sep=";", index_col=None)
@@ -226,39 +226,39 @@ def test_from_to_postgis(self):
 
 class TestLocations:
     """Test for 'read_locations_csv' and 'write_locations_csv' functions."""
-    
+
     def test_from_to_csv(self):
         """Test basic reading and writing functions."""
-        orig_file = os.path.join('tests', 'data', 'locations.csv')
-        mod_file = os.path.join('tests', 'data', 'locations_mod_columns.csv')
-        tmp_file = os.path.join('tests', 'data', 'locations_test.csv')
-        mod_locs = ti.read_locations_csv(mod_file, columns={'geom': 'center'}, sep=';', index_col="id")
-        locs = ti.read_locations_csv(orig_file, sep=';', index_col="id")
+        orig_file = os.path.join("tests", "data", "locations.csv")
+        mod_file = os.path.join("tests", "data", "locations_mod_columns.csv")
+        tmp_file = os.path.join("tests", "data", "locations_test.csv")
+        mod_locs = ti.read_locations_csv(mod_file, columns={"geom": "center"}, sep=";", index_col="id")
+        locs = ti.read_locations_csv(orig_file, sep=";", index_col="id")
         assert mod_locs.equals(locs)
-        locs.as_locations.to_csv(tmp_file, sep=';', columns=['user_id', 'elevation', 'center', 'extent'])
+        locs.as_locations.to_csv(tmp_file, sep=";", columns=["user_id", "elevation", "center", "extent"])
         assert filecmp.cmp(orig_file, tmp_file, shallow=False)
         os.remove(tmp_file)
 
     def test_set_crs(self):
         """Test setting the crs when reading."""
-        file = os.path.join('tests', 'data', 'locations.csv')
+        file = os.path.join("tests", "data", "locations.csv")
         crs = "EPSG:2056"
-        locs = ti.read_locations_csv(file, sep=';', index_col="id")
+        locs = ti.read_locations_csv(file, sep=";", index_col="id")
         assert locs.crs is None
-        
-        locs = ti.read_locations_csv(file, sep=';', index_col="id", crs=crs)
+
+        locs = ti.read_locations_csv(file, sep=";", index_col="id", crs=crs)
         assert locs.crs == crs
-        
+
     def test_set_index_warning(self):
         """Test if a warning is raised when not parsing the index_col argument."""
-        file = os.path.join('tests', 'data', 'locations.csv')
+        file = os.path.join("tests", "data", "locations.csv")
         with pytest.warns(UserWarning):
-            ti.read_locations_csv(file, sep=';')
+            ti.read_locations_csv(file, sep=";")
 
     def test_set_index(self):
         """Test if `index_col` can be set."""
-        file = os.path.join('tests', 'data', 'locations.csv')
-        ind_name = 'id'
+        file = os.path.join("tests", "data", "locations.csv")
+        ind_name = "id"
         pfs = ti.read_locations_csv(file, sep=";", index_col=ind_name)
         assert pfs.index.name == ind_name
         pfs = ti.read_locations_csv(file, sep=";", index_col=None)
@@ -267,58 +267,60 @@ def test_set_index(self):
     def test_from_to_postgis(self):
         # TODO Implement some tests for PostGIS.
         pass
-    
+
+
 class TestTrips:
     """Test for 'read_trips_csv' and 'write_trips_csv' functions."""
-    
+
     def test_from_to_csv(self):
         """Test basic reading and writing functions."""
-        orig_file = os.path.join('tests', 'data', 'trips.csv')
-        mod_file = os.path.join('tests', 'data', 'trips_mod_columns.csv')
-        tmp_file = os.path.join('tests', 'data', 'trips_test.csv')
-        trips = ti.read_trips_csv(orig_file, sep=';', index_col="id")
-        column_mapping = {'orig_stp': 'origin_staypoint_id', 'dest_stp': 'destination_staypoint_id'}
-        mod_trips = ti.read_trips_csv(mod_file, columns=column_mapping, sep=';', index_col="id")
+        orig_file = os.path.join("tests", "data", "trips.csv")
+        mod_file = os.path.join("tests", "data", "trips_mod_columns.csv")
+        tmp_file = os.path.join("tests", "data", "trips_test.csv")
+        trips = ti.read_trips_csv(orig_file, sep=";", index_col="id")
+        column_mapping = {"orig_stp": "origin_staypoint_id", "dest_stp": "destination_staypoint_id"}
+        mod_trips = ti.read_trips_csv(mod_file, columns=column_mapping, sep=";", index_col="id")
         assert mod_trips.equals(trips)
-        
-        trips['started_at'] = trips['started_at'].apply(lambda d: d.isoformat().replace('+00:00', 'Z'))
-        trips['finished_at'] = trips['finished_at'].apply(lambda d: d.isoformat().replace('+00:00', 'Z'))
-        columns = ['user_id', 'started_at', 'finished_at', 'origin_staypoint_id', 'destination_staypoint_id']
-        trips.as_trips.to_csv(tmp_file, sep=';', columns=columns)
+
+        trips["started_at"] = trips["started_at"].apply(lambda d: d.isoformat().replace("+00:00", "Z"))
+        trips["finished_at"] = trips["finished_at"].apply(lambda d: d.isoformat().replace("+00:00", "Z"))
+        columns = ["user_id", "started_at", "finished_at", "origin_staypoint_id", "destination_staypoint_id"]
+        trips.as_trips.to_csv(tmp_file, sep=";", columns=columns)
         assert filecmp.cmp(orig_file, tmp_file, shallow=False)
         os.remove(tmp_file)
-        
+
     def test_set_datatime_tz(self):
         """Test setting the timezone infomation when reading."""
         # check if tz is added to the datatime column
-        file = os.path.join('tests', 'data', 'trips.csv')
-        trips = ti.read_trips_csv(file, sep=';', index_col="id")
+        file = os.path.join("tests", "data", "trips.csv")
+        trips = ti.read_trips_csv(file, sep=";", index_col="id")
         assert pd.api.types.is_datetime64tz_dtype(trips["started_at"])
-        
+
         # check if a timezone will be set after manually deleting the timezone
-        trips['started_at'] = trips['started_at'].dt.tz_localize(None)
+        trips["started_at"] = trips["started_at"].dt.tz_localize(None)
         assert not pd.api.types.is_datetime64tz_dtype(trips["started_at"])
-        tmp_file = os.path.join('tests', 'data', 'trips_test.csv')
-        trips.as_trips.to_csv(tmp_file, sep=';')
-        trips = ti.read_trips_csv(tmp_file, sep=';', index_col="id", tz = 'utc')
-        
+        tmp_file = os.path.join("tests", "data", "trips_test.csv")
+        trips.as_trips.to_csv(tmp_file, sep=";")
+        trips = ti.read_trips_csv(tmp_file, sep=";", index_col="id", tz="utc")
+
         assert pd.api.types.is_datetime64tz_dtype(trips["started_at"])
-        
+
         # check if a warning is raised if 'tz' is not provided
         with pytest.warns(UserWarning):
-            ti.read_trips_csv(tmp_file, sep=';', index_col="id")
-        
+            ti.read_trips_csv(tmp_file, sep=";", index_col="id")
+
         os.remove(tmp_file)
+
     def test_set_index_warning(self):
         """Test if a warning is raised when not parsing the index_col argument."""
-        file = os.path.join('tests', 'data', 'trips.csv')
+        file = os.path.join("tests", "data", "trips.csv")
         with pytest.warns(UserWarning):
-            ti.read_trips_csv(file, sep=';')
+            ti.read_trips_csv(file, sep=";")
 
     def test_set_index(self):
         """Test if `index_col` can be set."""
-        file = os.path.join('tests', 'data', 'trips.csv')
-        ind_name = 'id'
+        file = os.path.join("tests", "data", "trips.csv")
+        ind_name = "id"
         gdf = ti.read_trips_csv(file, sep=";", index_col=ind_name)
         assert gdf.index.name == ind_name
         gdf = ti.read_trips_csv(file, sep=";", index_col=None)
@@ -328,9 +330,10 @@ def test_from_to_postgis(self):
         # TODO Implement some tests for PostGIS.
         pass
 
+
 class TestTours:
     """Test for 'read_tours_csv' and 'write_tours_csv' functions."""
-    
+
     def test_from_to_postgis(self):
         # TODO Implement some tests for reading and writing tours.
         pass
diff --git a/tests/io/test_from_geopandas.py b/tests/io/test_from_geopandas.py
index 39f6f018..558ee1df 100644
--- a/tests/io/test_from_geopandas.py
+++ b/tests/io/test_from_geopandas.py
@@ -8,63 +8,64 @@
 
 class TestFromGeopandas:
     """Test for all 'read_*_gpd' functions."""
-    
+
     def test_read_positionfixes_gpd(self):
         """Test if the results of reading from gpd and csv agrees."""
-        gdf = gpd.read_file(os.path.join('tests', 'data', 'positionfixes.geojson'))
-        gdf.set_index('id', inplace=True)
-        pfs_from_gpd = ti.io.from_geopandas.read_positionfixes_gpd(gdf, user_id='User', geom='geometry', tz='utc')
-        
-        pfs_file = os.path.join('tests', 'data', 'positionfixes.csv')
-        pfs_from_csv = ti.read_positionfixes_csv(pfs_file, sep=';', tz='utc', index_col='id')
+        gdf = gpd.read_file(os.path.join("tests", "data", "positionfixes.geojson"))
+        gdf.set_index("id", inplace=True)
+        pfs_from_gpd = ti.io.from_geopandas.read_positionfixes_gpd(gdf, user_id="User", geom="geometry", tz="utc")
+
+        pfs_file = os.path.join("tests", "data", "positionfixes.csv")
+        pfs_from_csv = ti.read_positionfixes_csv(pfs_file, sep=";", tz="utc", index_col="id")
 
         pd.testing.assert_frame_equal(pfs_from_gpd, pfs_from_csv, check_exact=False)
 
     def test_read_triplegs_gpd(self):
         """Test if the results of reading from gpd and csv agrees."""
-        gdf = gpd.read_file(os.path.join('tests', 'data', 'triplegs.geojson'))
-        gdf.set_index('id', inplace=True)
-        tpls_from_gpd = ti.io.from_geopandas.read_triplegs_gpd(gdf, user_id='User', geom='geometry', tz='utc')
-        
-        tpls_file = os.path.join('tests', 'data', 'triplegs.csv')
-        tpls_from_csv = ti.read_triplegs_csv(tpls_file, sep=';', tz='utc', index_col='id')
+        gdf = gpd.read_file(os.path.join("tests", "data", "triplegs.geojson"))
+        gdf.set_index("id", inplace=True)
+        tpls_from_gpd = ti.io.from_geopandas.read_triplegs_gpd(gdf, user_id="User", geom="geometry", tz="utc")
+
+        tpls_file = os.path.join("tests", "data", "triplegs.csv")
+        tpls_from_csv = ti.read_triplegs_csv(tpls_file, sep=";", tz="utc", index_col="id")
 
         pd.testing.assert_frame_equal(tpls_from_gpd, tpls_from_csv, check_exact=False)
 
     def test_read_staypoints_gpd(self):
         """Test if the results of reading from gpd and csv agrees."""
-        gdf = gpd.read_file(os.path.join('tests', 'data', 'staypoints.geojson'))
-        gdf.set_index('id', inplace=True)
-        stps_from_gpd = ti.io.from_geopandas.read_staypoints_gpd(gdf, 'start_time', 'end_time', geom='geometry',
-                                                                 tz='utc')
-        
-        stps_file = os.path.join('tests', 'data', 'staypoints.csv')
-        stps_from_csv = ti.read_staypoints_csv(stps_file, sep=';', tz='utc', index_col='id')
+        gdf = gpd.read_file(os.path.join("tests", "data", "staypoints.geojson"))
+        gdf.set_index("id", inplace=True)
+        stps_from_gpd = ti.io.from_geopandas.read_staypoints_gpd(
+            gdf, "start_time", "end_time", geom="geometry", tz="utc"
+        )
+
+        stps_file = os.path.join("tests", "data", "staypoints.csv")
+        stps_from_csv = ti.read_staypoints_csv(stps_file, sep=";", tz="utc", index_col="id")
 
         pd.testing.assert_frame_equal(stps_from_gpd, stps_from_csv, check_exact=False)
 
     def test_read_locations_gpd(self):
         """Test if the results of reading from gpd and csv agrees."""
         # TODO: Problem with multiple geometry columns and geojson format
-        gdf = gpd.read_file(os.path.join('tests', 'data', 'locations.geojson'))
-        gdf.set_index('id', inplace=True)
-        locs_from_gpd = ti.io.from_geopandas.read_locations_gpd(gdf, user_id='User', center='geometry')
-        
-        locs_file = os.path.join('tests', 'data', 'locations.csv')
-        locs_from_csv = ti.read_locations_csv(locs_file, sep=';', index_col='id')
+        gdf = gpd.read_file(os.path.join("tests", "data", "locations.geojson"))
+        gdf.set_index("id", inplace=True)
+        locs_from_gpd = ti.io.from_geopandas.read_locations_gpd(gdf, user_id="User", center="geometry")
+
+        locs_file = os.path.join("tests", "data", "locations.csv")
+        locs_from_csv = ti.read_locations_csv(locs_file, sep=";", index_col="id")
 
         # drop the second geometry column manually because not storable in GeoJSON (from Geopandas)
-        locs_from_csv = locs_from_csv.drop(columns='extent')
+        locs_from_csv = locs_from_csv.drop(columns="extent")
         pd.testing.assert_frame_equal(locs_from_csv, locs_from_gpd, check_exact=False)
 
     def test_read_trips_gpd(self):
         """Test if the results of reading from gpd and csv agrees."""
-        df = pd.read_csv(os.path.join('tests', 'data', 'trips.csv'), sep=';')
-        df.set_index('id', inplace=True)
-        trips_from_gpd = ti.io.from_geopandas.read_trips_gpd(df, tz='utc')
-        
-        trips_file = os.path.join('tests', 'data', 'trips.csv')
-        trips_from_csv = ti.read_trips_csv(trips_file, sep=';', tz='utc', index_col='id')
+        df = pd.read_csv(os.path.join("tests", "data", "trips.csv"), sep=";")
+        df.set_index("id", inplace=True)
+        trips_from_gpd = ti.io.from_geopandas.read_trips_gpd(df, tz="utc")
+
+        trips_file = os.path.join("tests", "data", "trips.csv")
+        trips_from_csv = ti.read_trips_csv(trips_file, sep=";", tz="utc", index_col="id")
 
         pd.testing.assert_frame_equal(trips_from_gpd, trips_from_csv, check_exact=False)
 
diff --git a/tests/io/test_postgis_gpd.py b/tests/io/test_postgis_gpd.py
index b595e8ac..b0b3e1dc 100644
--- a/tests/io/test_postgis_gpd.py
+++ b/tests/io/test_postgis_gpd.py
@@ -10,6 +10,7 @@
 from geopandas.tests.util import create_postgis, create_spatialite, validate_boro_df
 import pytest
 
+
 @pytest.fixture()
 def engine_postgis():
     """
@@ -42,6 +43,7 @@ def engine_postgis():
     yield con
     con.dispose()
 
+
 @pytest.fixture
 def df_nybb():
     nybb_path = geopandas.datasets.get_path("nybb")
@@ -64,15 +66,14 @@ def connection_postgis():
     host = os.environ.get("PGHOST")
     port = os.environ.get("PGPORT")
     try:
-        con = psycopg2.connect(
-            dbname=dbname, user=user, password=password, host=host, port=port
-        )
+        con = psycopg2.connect(dbname=dbname, user=user, password=password, host=host, port=port)
     except OperationalError:
         pytest.skip("Cannot connect with postgresql database")
 
     yield con
     con.close()
 
+
 class TestIO:
     def test_read_postgis_default(self, connection_postgis, df_nybb):
         con = connection_postgis
@@ -87,4 +88,4 @@ def test_read_postgis_default(self, connection_postgis, df_nybb):
         assert df.crs is None
 
     # def test_postgis_test_that_fails():
-    #     pytest.skip("This skip should cause a fail for the postgis test run")
\ No newline at end of file
+    #     pytest.skip("This skip should cause a fail for the postgis test run")
diff --git a/tests/model/test_locations.py b/tests/model/test_locations.py
index 673704e9..19c7dbd9 100644
--- a/tests/model/test_locations.py
+++ b/tests/model/test_locations.py
@@ -1,4 +1,3 @@
-
 import os
 import pytest
 
@@ -10,29 +9,29 @@
 @pytest.fixture
 def testdata_locs():
     """Read location test data from files."""
-    stps_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-    stps = ti.read_staypoints_csv(stps_file, tz='utc', index_col='id')
-    stps, locs = stps.as_staypoints.generate_locations(method='dbscan', 
-                                                        epsilon=10, 
-                                                        num_samples=0, 
-                                                        distance_matrix_metric='haversine',
-                                                        agg_level='dataset')
+    stps_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+    stps = ti.read_staypoints_csv(stps_file, tz="utc", index_col="id")
+    stps, locs = stps.as_staypoints.generate_locations(
+        method="dbscan", epsilon=10, num_samples=0, distance_matrix_metric="haversine", agg_level="dataset"
+    )
     return locs
 
 
 class TestLocations:
     """Tests for the LocationsAccessor."""
-    
+
     def test_accessor_column(self, testdata_locs):
         """Test if the as_locations accessor checks the required column for locations."""
         locs = testdata_locs.copy()
 
         with pytest.raises(AttributeError, match="To process a DataFrame as a collection of locations"):
-            locs.drop(['user_id'], axis=1).as_locations
-    
+            locs.drop(["user_id"], axis=1).as_locations
+
     def test_accessor_geometry_type(self, testdata_locs):
         """Test if the as_locations accessor requires Point geometry."""
         locs = testdata_locs.copy()
         with pytest.raises(AttributeError, match="The center geometry must be a Point"):
-            locs['center'] = LineString([(13.476808430, 48.573711823), (13.506804, 48.939008), (13.4664690, 48.5706414)])
-            locs.as_locations
\ No newline at end of file
+            locs["center"] = LineString(
+                [(13.476808430, 48.573711823), (13.506804, 48.939008), (13.4664690, 48.5706414)]
+            )
+            locs.as_locations
diff --git a/tests/model/test_positionfixes.py b/tests/model/test_positionfixes.py
index 3806f366..68b4d983 100644
--- a/tests/model/test_positionfixes.py
+++ b/tests/model/test_positionfixes.py
@@ -13,46 +13,45 @@ def testdata_geolife():
     pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife"))
     return pfs
 
+
 class TestPositionfixes:
     """Tests for the PositionfixesAccessor."""
-    
+
     def test_accessor_column(self, testdata_geolife):
         """Test if the as_positionfixes accessor checks the required column for positionfixes."""
         pfs = testdata_geolife.copy()
         assert pfs.as_positionfixes
-            
+
         # check user_id
         with pytest.raises(AttributeError, match="To process a DataFrame as a collection of positionfixes"):
-            pfs.drop(['user_id'], axis=1).as_positionfixes
+            pfs.drop(["user_id"], axis=1).as_positionfixes
 
-    
     def test_accessor_geometry(self, testdata_geolife):
         """Test if the as_positionfixes accessor requires geometry column."""
         pfs = testdata_geolife.copy()
-        
+
         # check geometry
         with pytest.raises(AttributeError, match="No geometry data set yet"):
-            pfs.drop(['geom'], axis=1).as_positionfixes
-          
+            pfs.drop(["geom"], axis=1).as_positionfixes
+
     def test_accessor_geometry_type(self, testdata_geolife):
         """Test if the as_positionfixes accessor requires Point geometry."""
         pfs = testdata_geolife.copy()
-            
+
         # check geometry type
         with pytest.raises(AttributeError, match="The geometry must be a Point"):
-            pfs['geom'] = LineString([(13.476808430, 48.573711823), (13.506804, 48.939008), (13.4664690, 48.5706414)])
+            pfs["geom"] = LineString([(13.476808430, 48.573711823), (13.506804, 48.939008), (13.4664690, 48.5706414)])
             pfs.as_positionfixes
 
-
     def test_center(self, testdata_geolife):
         """Check if pfs has center method and returns (lat, lon) pairs as geometry."""
         pfs = testdata_geolife
         assert len(pfs.as_positionfixes.center) == 2
-        
+
     def test_similarity_matrix(self, testdata_geolife):
         """Check the similarity_matrix function called through accessor runs as expected."""
         pfs = testdata_geolife
-        
-        accessor_result = pfs.as_positionfixes.calculate_distance_matrix(dist_metric='haversine', n_jobs=1)
-        function_result = ti.geogr.distances.calculate_distance_matrix(pfs, dist_metric='haversine', n_jobs=1)
+
+        accessor_result = pfs.as_positionfixes.calculate_distance_matrix(dist_metric="haversine", n_jobs=1)
+        function_result = ti.geogr.distances.calculate_distance_matrix(pfs, dist_metric="haversine", n_jobs=1)
         assert np.allclose(accessor_result, function_result)
diff --git a/tests/model/test_staypoints.py b/tests/model/test_staypoints.py
index 6e81a823..37fd65d8 100644
--- a/tests/model/test_staypoints.py
+++ b/tests/model/test_staypoints.py
@@ -10,10 +10,11 @@
 @pytest.fixture
 def testdata_stps():
     """Read stps test data from files."""
-    stps_file = os.path.join('tests', 'data', 'staypoints.csv')
-    stps = ti.read_staypoints_csv(stps_file, sep=';', index_col='id')
+    stps_file = os.path.join("tests", "data", "staypoints.csv")
+    stps = ti.read_staypoints_csv(stps_file, sep=";", index_col="id")
     return stps
 
+
 class TestStaypoints:
     """Tests for the StaypointsAccessor."""
 
@@ -21,22 +22,22 @@ def test_accessor_columns(self, testdata_stps):
         """Test if the as_staypoints accessor checks the required column for staypoints."""
         stps = testdata_stps.copy()
         assert stps.as_staypoints
-        
+
         with pytest.raises(AttributeError, match="To process a DataFrame as a collection of staypoints"):
-            stps.drop(['user_id'], axis=1).as_staypoints
-            
+            stps.drop(["user_id"], axis=1).as_staypoints
+
     def test_accessor_geometry(self, testdata_stps):
         """Test if the as_staypoints accessor requires geometry column."""
         stps = testdata_stps.copy()
-        
+
         # geometery
         with pytest.raises(AttributeError, match="No geometry data set yet"):
-            stps.drop(['geom'], axis=1).as_staypoints
-            
+            stps.drop(["geom"], axis=1).as_staypoints
+
     def test_accessor_geometry_type(self, testdata_stps):
         """Test if the as_staypoints accessor requires Point geometry."""
         stps = testdata_stps.copy()
-        
+
         # check geometry type
         with pytest.raises(AttributeError, match="The geometry must be a Point"):
             stps["geom"] = LineString([(13.476808430, 48.573711823), (13.506804, 48.939008), (13.4664690, 48.5706414)])
diff --git a/tests/model/test_triplegs.py b/tests/model/test_triplegs.py
index 615a74f4..288400b6 100644
--- a/tests/model/test_triplegs.py
+++ b/tests/model/test_triplegs.py
@@ -5,13 +5,14 @@
 
 import trackintel as ti
 
+
 @pytest.fixture
 def testdata_tpls():
     """Read triplegs test data from files."""
     pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife"))
     pfs, stps = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=25, time_threshold=5)
     _, tpls = pfs.as_positionfixes.generate_triplegs(stps, method="between_staypoints")
-        
+
     return tpls
 
 
@@ -21,26 +22,26 @@ class TestTriplegs:
     def test_accessor_column(self, testdata_tpls):
         """Test if the as_triplegs accessor checks the required column for triplegs."""
         tpls = testdata_tpls.copy()
-        
+
         assert tpls.as_triplegs
-            
+
         # check user_id
         with pytest.raises(AttributeError):
-            tpls.drop(['user_id'], axis=1).as_triplegs
+            tpls.drop(["user_id"], axis=1).as_triplegs
 
     def test_accessor_geometry(self, testdata_tpls):
         """Test if the as_triplegs accessor requires geometry column."""
         tpls = testdata_tpls.copy()
-        
+
         # check geometry
         with pytest.raises(AttributeError, match="No geometry data set yet"):
-            tpls.drop(['geom'], axis=1).as_triplegs
-            
+            tpls.drop(["geom"], axis=1).as_triplegs
+
     def test_accessor_geometry_type(self, testdata_tpls):
         """Test if the as_triplegs accessor requires LineString geometry."""
         tpls = testdata_tpls.copy()
-            
+
         # check geometry type
         with pytest.raises(AttributeError, match="The geometry must be a LineString"):
             tpls["geom"] = Point([(13.476808430, 48.573711823)])
-            tpls.as_triplegs
\ No newline at end of file
+            tpls.as_triplegs
diff --git a/tests/model/test_trips.py b/tests/model/test_trips.py
index 9a789670..44c1dcce 100644
--- a/tests/model/test_trips.py
+++ b/tests/model/test_trips.py
@@ -3,14 +3,15 @@
 
 import trackintel as ti
 
+
 class TestTrips:
     """Tests for the TripsAccessor."""
 
     def test_accessor(self):
         """Test if the as_trips accessor checks the required column for trips."""
-        trips = ti.read_trips_csv(os.path.join('tests', 'data', 'geolife_long', 'trips.csv'), index_col='id')
+        trips = ti.read_trips_csv(os.path.join("tests", "data", "geolife_long", "trips.csv"), index_col="id")
         assert trips.as_trips
-            
+
         # user_id
         with pytest.raises(AttributeError):
-            trips.drop(['user_id'], axis=1).as_trips
+            trips.drop(["user_id"], axis=1).as_trips
diff --git a/tests/model/test_users.py b/tests/model/test_users.py
index f657c2c8..efec6485 100644
--- a/tests/model/test_users.py
+++ b/tests/model/test_users.py
@@ -6,15 +6,15 @@
 
 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)
+        users.rename(columns={"user_id": "id"}, inplace=True)
         assert users.as_users
 
-        users = users.drop(['id'], axis=1)
+        users = users.drop(["id"], axis=1)
         with pytest.raises(AttributeError):
-            users.as_users
\ No newline at end of file
+            users.as_users
diff --git a/tests/preprocessing/test_filter.py b/tests/preprocessing/test_filter.py
index fba6b826..919d030c 100644
--- a/tests/preprocessing/test_filter.py
+++ b/tests/preprocessing/test_filter.py
@@ -10,109 +10,114 @@
 def locs_from_geolife():
     """Create locations from geolife staypoints."""
     # read staypoints
-    spts_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-    spts = ti.read_staypoints_csv(spts_file, tz='utc', index_col='id')
-    
-    
+    spts_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+    spts = ti.read_staypoints_csv(spts_file, tz="utc", index_col="id")
+
     # cluster staypoints to locations
-    _, locs = spts.as_staypoints.generate_locations(method='dbscan', epsilon=10, 
-                                                    num_samples=0, distance_matrix_metric='haversine',
-                                                    agg_level='dataset')
-    
+    _, locs = spts.as_staypoints.generate_locations(
+        method="dbscan", epsilon=10, num_samples=0, distance_matrix_metric="haversine", agg_level="dataset"
+    )
+
     # the projection needs to be defined: WGS84
-    locs.crs = 'epsg:4326'
+    locs.crs = "epsg:4326"
     return locs
 
-class TestSpatial_filter():
+
+class TestSpatial_filter:
     """Tests for the spatial_filter function."""
-    
+
     def test_filter_staypoints(self):
         """Test if spatial_filter works for staypoints."""
         # read staypoints and area file
-        spts_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-        spts = ti.read_staypoints_csv(spts_file, tz='utc', index_col='id')
-        extent = gpd.read_file(os.path.join('tests', 'data', 'area', 'tsinghua.geojson'))
-        
+        spts_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+        spts = ti.read_staypoints_csv(spts_file, tz="utc", index_col="id")
+        extent = gpd.read_file(os.path.join("tests", "data", "area", "tsinghua.geojson"))
+
         # the projection needs to be defined: WGS84
-        spts.crs = 'epsg:4326'
+        spts.crs = "epsg:4326"
         within_spts = spts.as_staypoints.spatial_filter(areas=extent, method="within", re_project=True)
         intersects_spts = spts.as_staypoints.spatial_filter(areas=extent, method="intersects", re_project=True)
         crosses_spts = spts.as_staypoints.spatial_filter(areas=extent, method="crosses", re_project=True)
-        
+
         # the result obtained from ArcGIS
         gis_within_num = 13
-        
-        assert len(within_spts) == gis_within_num, "The spatial filtered sp number should be the same as" + \
-            "the one from the result with ArcGIS"
+
+        assert len(within_spts) == gis_within_num, (
+            "The spatial filtered sp number should be the same as" + "the one from the result with ArcGIS"
+        )
         assert len(crosses_spts) == 0, "There will be no point crossing area"
-        
+
         # For staypoints the result of within and intersects should be the same
         assert_geodataframe_equal(within_spts, intersects_spts, check_less_precise=True)
-        
+
     def test_filter_triplegs(self):
         """Test if spatial_filter works for triplegs."""
         # read triplegs and area file
-        tpls_file = os.path.join('tests', 'data', 'geolife', 'geolife_triplegs.csv')
-        tpls = ti.read_triplegs_csv(tpls_file, tz='utc', index_col='id')
-        extent = gpd.read_file(os.path.join('tests', 'data', 'area', 'tsinghua.geojson'))
-        
+        tpls_file = os.path.join("tests", "data", "geolife", "geolife_triplegs.csv")
+        tpls = ti.read_triplegs_csv(tpls_file, tz="utc", index_col="id")
+        extent = gpd.read_file(os.path.join("tests", "data", "area", "tsinghua.geojson"))
+
         # the projection needs to be defined: WGS84
-        tpls.crs = 'epsg:4326'
+        tpls.crs = "epsg:4326"
         within_tl = tpls.as_triplegs.spatial_filter(areas=extent, method="within", re_project=True)
         intersects_tl = tpls.as_triplegs.spatial_filter(areas=extent, method="intersects", re_project=True)
         crosses_tl = tpls.as_triplegs.spatial_filter(areas=extent, method="crosses", re_project=True)
-        
+
         # the result obtained from ArcGIS
         gis_within_num = 9
         gis_intersects_num = 20
-        
-        assert len(within_tl) == gis_within_num, "The within tripleg number should be the same as" + \
-            "the one from the result with ArcGIS"
-        assert len(intersects_tl) == gis_intersects_num, "The intersects tripleg number should be " + \
-            "the same as the one from the result with ArcGIS"
-        assert len(crosses_tl) == len(intersects_tl) - len(within_tl), "The crosses tripleg number" + \
-            "should equal the number of intersect triplegs minus the number of within triplegs"
-    
+
+        assert len(within_tl) == gis_within_num, (
+            "The within tripleg number should be the same as" + "the one from the result with ArcGIS"
+        )
+        assert len(intersects_tl) == gis_intersects_num, (
+            "The intersects tripleg number should be " + "the same as the one from the result with ArcGIS"
+        )
+        assert len(crosses_tl) == len(intersects_tl) - len(within_tl), (
+            "The crosses tripleg number"
+            + "should equal the number of intersect triplegs minus the number of within triplegs"
+        )
+
     def test_filter_locations(self, locs_from_geolife):
         """Test if spatial_filter works for locations."""
         locs = locs_from_geolife
-        extent = gpd.read_file(os.path.join('tests', 'data', 'area', 'tsinghua.geojson'))
-        
+        extent = gpd.read_file(os.path.join("tests", "data", "area", "tsinghua.geojson"))
+
         # filter locations with the area
         within_loc = locs.as_locations.spatial_filter(areas=extent, method="within", re_project=True)
         intersects_loc = locs.as_locations.spatial_filter(areas=extent, method="intersects", re_project=True)
         crosses_loc = locs.as_locations.spatial_filter(areas=extent, method="crosses", re_project=True)
-        
+
         # the result obtained from ArcGIS
         gis_within_num = 12
-        
-        assert len(within_loc) == gis_within_num, "The spatial filtered location number should be the same as" + \
-            "the one from the result with ArcGIS"
+
+        assert len(within_loc) == gis_within_num, (
+            "The spatial filtered location number should be the same as" + "the one from the result with ArcGIS"
+        )
         assert len(crosses_loc) == 0, "There will be no point crossing area"
-        
+
         # For location the result of within and intersects should be the same
         assert_geodataframe_equal(within_loc, intersects_loc, check_less_precise=True)
-        
-        
+
     def test_re_project(self, locs_from_geolife):
         """Test if passing the re_project parameter will reproject the input gdf."""
-        locs = locs_from_geolife 
-        extent = gpd.read_file(os.path.join('tests', 'data', 'area', 'tsinghua.geojson'))
-        
+        locs = locs_from_geolife
+        extent = gpd.read_file(os.path.join("tests", "data", "area", "tsinghua.geojson"))
+
         # filter locations with the area, reproject
         within_loc_reProj = locs.as_locations.spatial_filter(areas=extent, method="within", re_project=True)
-        
+
         # manual reproject
         init_crs = locs.crs
         locs = locs.to_crs(extent.crs)
         within_loc = locs.as_locations.spatial_filter(areas=extent, method="within", re_project=False)
         within_loc = within_loc.to_crs(init_crs)
-        
+
         assert_geodataframe_equal(within_loc_reProj, within_loc, check_less_precise=True)
-        
+
     def test_method_error(self, locs_from_geolife):
         """Test if the an error is raised when passing unknown 'method' to spatial_filter()."""
         locs = locs_from_geolife
-        extent = gpd.read_file(os.path.join('tests', 'data', 'area', 'tsinghua.geojson'))
+        extent = gpd.read_file(os.path.join("tests", "data", "area", "tsinghua.geojson"))
         with pytest.raises(AttributeError):
-            locs.as_locations.spatial_filter(areas=extent, method=12345)
\ No newline at end of file
+            locs.as_locations.spatial_filter(areas=extent, method=12345)
diff --git a/tests/preprocessing/test_positionfixes.py b/tests/preprocessing/test_positionfixes.py
index 878d21a0..aca1017a 100644
--- a/tests/preprocessing/test_positionfixes.py
+++ b/tests/preprocessing/test_positionfixes.py
@@ -11,49 +11,49 @@
 
 import trackintel as ti
 
+
 @pytest.fixture
 def geolife_pfs_stps_long():
     """Read geolife_long and generate stps."""
-    pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join('tests', 'data', 'geolife_long'))
-    pfs, stps = pfs.as_positionfixes.generate_staypoints(method='sliding', dist_threshold=25, time_threshold=5)
+    pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife_long"))
+    pfs, stps = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=25, time_threshold=5)
     return pfs, stps
 
 
-class TestGenerate_staypoints():
+class TestGenerate_staypoints:
     """Tests for generate_staypoints() method."""
-    
+
     def test_sliding_min(self):
         """Test if using small thresholds, stp extraction yields each pfs."""
-        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join('tests', 'data', 'geolife'))
-        pfs, stps = pfs.as_positionfixes.generate_staypoints(method='sliding', 
-                                                             dist_threshold=0, 
-                                                             time_threshold=0, 
-                                                             include_last=True)
+        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife"))
+        pfs, stps = pfs.as_positionfixes.generate_staypoints(
+            method="sliding", dist_threshold=0, time_threshold=0, include_last=True
+        )
         assert len(stps) == len(pfs)
 
     def test_sliding_max(self):
         """Test if using large thresholds, stp extraction yield no pfs."""
-        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join('tests', 'data', 'geolife'))
-        _, stps = pfs.as_positionfixes.generate_staypoints(method='sliding',
-                                                           dist_threshold=sys.maxsize,
-                                                           time_threshold=sys.maxsize)
+        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife"))
+        _, stps = pfs.as_positionfixes.generate_staypoints(
+            method="sliding", dist_threshold=sys.maxsize, time_threshold=sys.maxsize
+        )
         assert len(stps) == 0
 
     def test_missing_link(self):
         """Test nan is assigned for missing link between pfs and stps."""
-        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join('tests', 'data', 'geolife'))
-        pfs, _ = pfs.as_positionfixes.generate_staypoints(method='sliding',
-                                                          dist_threshold=sys.maxsize,
-                                                          time_threshold=sys.maxsize)
+        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife"))
+        pfs, _ = pfs.as_positionfixes.generate_staypoints(
+            method="sliding", dist_threshold=sys.maxsize, time_threshold=sys.maxsize
+        )
 
-        assert pd.isna(pfs['staypoint_id']).any()
+        assert pd.isna(pfs["staypoint_id"]).any()
 
     def test_dtype_consistent(self, geolife_pfs_stps_long):
         """Test the dtypes for the generated columns."""
         pfs, stps = geolife_pfs_stps_long
-        
-        assert pfs['user_id'].dtype == stps['user_id'].dtype
-        assert pfs['staypoint_id'].dtype == "Int64"
+
+        assert pfs["user_id"].dtype == stps["user_id"].dtype
+        assert pfs["staypoint_id"].dtype == "Int64"
         assert stps.index.dtype == "int64"
 
     def test_index_start(self, geolife_pfs_stps_long):
@@ -64,65 +64,61 @@ def test_index_start(self, geolife_pfs_stps_long):
 
     def test_include_last(self):
         """Test if the include_last arguement will include the last pfs as stp."""
-        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join('tests', 'data', 'geolife'))
-
-        pfs_wo, stps_wo = pfs.as_positionfixes.generate_staypoints(method='sliding',
-                                                           dist_threshold=100,
-                                                           time_threshold=5.0,
-                                                           include_last=False)
-        pfs_include, stps_include = pfs.as_positionfixes.generate_staypoints(method='sliding',
-                                                           dist_threshold=100,
-                                                           time_threshold=5.0,
-                                                           include_last=True)
+        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife"))
+
+        pfs_wo, stps_wo = pfs.as_positionfixes.generate_staypoints(
+            method="sliding", dist_threshold=100, time_threshold=5.0, include_last=False
+        )
+        pfs_include, stps_include = pfs.as_positionfixes.generate_staypoints(
+            method="sliding", dist_threshold=100, time_threshold=5.0, include_last=True
+        )
         # stps_wo does not include the last staypoint
         assert len(stps_wo) == len(stps_include) - 1
         # the last pfs of pfs_include has stp connection
-        assert not pfs_include.tail(1)['staypoint_id'].isna().all()
-        assert pfs_wo.tail(1)['staypoint_id'].isna().all()
-        
+        assert not pfs_include.tail(1)["staypoint_id"].isna().all()
+        assert pfs_wo.tail(1)["staypoint_id"].isna().all()
+
     def test_print_progress(self):
         """Test if the result from print progress agrees with the original."""
-        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join('tests', 'data', 'geolife'))
-        pfs_ori, stps_ori = pfs.as_positionfixes.generate_staypoints(method='sliding', 
-                                                             dist_threshold=100, 
-                                                             time_threshold=5)
-        pfs_print, stps_print = pfs.as_positionfixes.generate_staypoints(method='sliding', 
-                                                             dist_threshold=100, 
-                                                             time_threshold=5,
-                                                             print_progress=True)
+        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife"))
+        pfs_ori, stps_ori = pfs.as_positionfixes.generate_staypoints(
+            method="sliding", dist_threshold=100, time_threshold=5
+        )
+        pfs_print, stps_print = pfs.as_positionfixes.generate_staypoints(
+            method="sliding", dist_threshold=100, time_threshold=5, print_progress=True
+        )
         assert_geodataframe_equal(pfs_ori, pfs_print)
         assert_geodataframe_equal(stps_ori, stps_print)
-        
+
     def test_temporal(self):
         """Test if the stps generation result follows predefined time_threshold and gap_threshold."""
-        pfs_input, _ = ti.io.dataset_reader.read_geolife(os.path.join('tests', 'data', 'geolife_long'))
-        
+        pfs_input, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife_long"))
+
         # the duration should be not longer than time_threshold
         time_threshold_ls = [3, 5, 10]
         for time_threshold in time_threshold_ls:
-            _, stps = pfs_input.as_positionfixes.generate_staypoints(method='sliding', 
-                                                                dist_threshold=50, 
-                                                                time_threshold=time_threshold)
+            _, stps = pfs_input.as_positionfixes.generate_staypoints(
+                method="sliding", dist_threshold=50, time_threshold=time_threshold
+            )
 
-            duration_stps_min = (stps['finished_at'] - stps['started_at']).dt.total_seconds() / 60
+            duration_stps_min = (stps["finished_at"] - stps["started_at"]).dt.total_seconds() / 60
             # all durations should be longer than the time_threshold
             assert (duration_stps_min > time_threshold).all()
-        
+
         # the missing time should not exceed gap_threshold
         gap_threshold_ls = [10, 15, 20]
         for gap_threshold in gap_threshold_ls:
-            pfs, _ = pfs_input.as_positionfixes.generate_staypoints(method='sliding', 
-                                                                dist_threshold=50, 
-                                                                time_threshold=time_threshold,
-                                                                gap_threshold=gap_threshold)
+            pfs, _ = pfs_input.as_positionfixes.generate_staypoints(
+                method="sliding", dist_threshold=50, time_threshold=time_threshold, gap_threshold=gap_threshold
+            )
             # get the difference between pfs tracking time, and assign back to the previous pfs
-            pfs["diff"] = ((pfs['tracked_at'] - pfs['tracked_at'].shift(1)).dt.total_seconds() / 60).shift(-1)
+            pfs["diff"] = ((pfs["tracked_at"] - pfs["tracked_at"].shift(1)).dt.total_seconds() / 60).shift(-1)
             # get the last pf of stps and check the gap size
             pfs.dropna(subset=["staypoint_id"], inplace=True)
-            pfs.drop_duplicates(subset=["staypoint_id"], keep='last', inplace=True)
+            pfs.drop_duplicates(subset=["staypoint_id"], keep="last", inplace=True)
             # all last pfs should be shorter than the gap_threshold
-            assert (pfs["diff"]<gap_threshold).all()
-        
+            assert (pfs["diff"] < gap_threshold).all()
+
 
 class TestGenerate_triplegs:
     """Tests for generate_triplegs() method."""
@@ -246,20 +242,20 @@ def test_invalid_inputs(self, geolife_pfs_stps_long):
     def test_temporal(self, geolife_pfs_stps_long):
         """Test if the tpls generation result follows predefined gap_threshold."""
         pfs_input, stps = geolife_pfs_stps_long
-        
+
         gap_threshold_ls = [0.1, 0.2, 1, 2]
         for gap_threshold in gap_threshold_ls:
             pfs, _ = pfs_input.as_positionfixes.generate_triplegs(stps, gap_threshold=gap_threshold)
-            
+
             # conti_tpl checks whether the next pfs is in the same tpl
-            pfs["conti_tpl"] = (pfs['tripleg_id'] - pfs['tripleg_id'].shift(1)).shift(-1)
+            pfs["conti_tpl"] = (pfs["tripleg_id"] - pfs["tripleg_id"].shift(1)).shift(-1)
             # get the time difference of pfs, and assign to the previous pfs
-            pfs["diff"] = ((pfs['tracked_at'] - pfs['tracked_at'].shift(1)).dt.total_seconds() / 60).shift(-1)
+            pfs["diff"] = ((pfs["tracked_at"] - pfs["tracked_at"].shift(1)).dt.total_seconds() / 60).shift(-1)
             # we only take tpls that are splitted in the middle (tpl - tpl) and the second user
             pfs = pfs.loc[(pfs["conti_tpl"] == 1) & (pfs["user_id"] == 1)]
-            # check if the cuts are appropriate 
-            assert (pfs['diff'] > gap_threshold).all()
-            
+            # check if the cuts are appropriate
+            assert (pfs["diff"] > gap_threshold).all()
+
     def test_stps_tpls_overlap(self, geolife_pfs_stps_long):
         """Tpls and spts should not overlap when generated using the default extract triplegs method."""
         pfs, stps = geolife_pfs_stps_long
@@ -277,4 +273,4 @@ def test_stps_tpls_overlap(self, geolife_pfs_stps_long):
             diff = diff.values[1:]
 
             # all values have to greater or equal to zero. Otherwise there is an overlap
-            assert all(diff >= np.timedelta64(datetime.timedelta()))
\ No newline at end of file
+            assert all(diff >= np.timedelta64(datetime.timedelta()))
diff --git a/tests/preprocessing/test_staypoints.py b/tests/preprocessing/test_staypoints.py
index 23aa58bc..d63f35a6 100644
--- a/tests/preprocessing/test_staypoints.py
+++ b/tests/preprocessing/test_staypoints.py
@@ -10,169 +10,166 @@
 from trackintel.geogr.distances import calculate_distance_matrix
 
 
-class TestGenerate_locations():
+class TestGenerate_locations:
     def test_generate_locations_dbscan_hav_euc(self):
-        stps_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-        stps = ti.read_staypoints_csv(stps_file, tz='utc', index_col='id')
-        
-        # haversine calculation 
-        _, loc_har = stps.as_staypoints.generate_locations(method='dbscan', epsilon=100, 
-                                                          num_samples=0, distance_matrix_metric='haversine',
-                                                          agg_level='dataset')
+        stps_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+        stps = ti.read_staypoints_csv(stps_file, tz="utc", index_col="id")
+
+        # haversine calculation
+        _, loc_har = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=100, num_samples=0, distance_matrix_metric="haversine", agg_level="dataset"
+        )
         # WGS_1984
-        stps.crs = 'epsg:4326'
-        # WGS_1984_UTM_Zone_49N 
+        stps.crs = "epsg:4326"
+        # WGS_1984_UTM_Zone_49N
         stps = stps.to_crs("epsg:32649")
-        
-        # euclidean calculation 
-        _, loc_eu = stps.as_staypoints.generate_locations(method='dbscan', epsilon=100, 
-                                                         num_samples=0, distance_matrix_metric='euclidean',
-                                                         agg_level='dataset')
-        
-        assert len(loc_har) == len(loc_eu) , "The #location should be the same for haversine" + \
-            "and euclidean distances"
-            
+
+        # euclidean calculation
+        _, loc_eu = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=100, num_samples=0, distance_matrix_metric="euclidean", agg_level="dataset"
+        )
+
+        assert len(loc_har) == len(loc_eu), "The #location should be the same for haversine" + "and euclidean distances"
+
     def test_generate_locations_dbscan_haversine(self):
-        stps_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-        stps = ti.read_staypoints_csv(stps_file, tz='utc', index_col='id')
-        
+        stps_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+        stps = ti.read_staypoints_csv(stps_file, tz="utc", index_col="id")
+
         # haversine calculation using sklearn.metrics.pairwise_distances
-        stps, locs = stps.as_staypoints.generate_locations(method='dbscan', epsilon=10, 
-                                                    num_samples=0, distance_matrix_metric='haversine',
-                                                    agg_level='dataset')
-        
+        stps, locs = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=10, num_samples=0, distance_matrix_metric="haversine", agg_level="dataset"
+        )
+
         # calculate pairwise haversine matrix and fed to dbscan
         sp_distance_matrix = calculate_distance_matrix(stps, dist_metric="haversine")
         db = DBSCAN(eps=10, min_samples=0, metric="precomputed")
         labels = db.fit_predict(sp_distance_matrix)
-        
-        assert len(set(locs.index)) == len(set(labels)) , "The number of locations should be the same"
-    
+
+        assert len(set(locs.index)) == len(set(labels)), "The number of locations should be the same"
+
     def test_generate_locations_dbscan_loc(self):
-        stps_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-        stps = ti.read_staypoints_csv(stps_file, tz='utc', index_col='id')
-        stps, locs = stps.as_staypoints.generate_locations(method='dbscan', epsilon=10,
-                                                           num_samples=0, distance_matrix_metric='haversine',
-                                                           agg_level='dataset')
+        stps_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+        stps = ti.read_staypoints_csv(stps_file, tz="utc", index_col="id")
+        stps, locs = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=10, num_samples=0, distance_matrix_metric="haversine", agg_level="dataset"
+        )
 
         # create locations as grouped staypoints, another way to create locations
-        other_locs = pd.DataFrame(columns=['user_id', 'id','center'])
-        grouped_df = stps.groupby(['user_id', 'location_id'])
+        other_locs = pd.DataFrame(columns=["user_id", "id", "center"])
+        grouped_df = stps.groupby(["user_id", "location_id"])
         for combined_id, group in grouped_df:
             user_id, location_id = combined_id
             group.set_geometry(stps.geometry.name, inplace=True)
 
             if int(location_id) != -1:
                 temp_loc = {}
-                temp_loc['user_id'] = user_id
-                temp_loc['id'] = location_id
-                
+                temp_loc["user_id"] = user_id
+                temp_loc["id"] = location_id
+
                 # point geometry of place
-                temp_loc['center'] = Point(group.geometry.x.mean(), group.geometry.y.mean())
+                temp_loc["center"] = Point(group.geometry.x.mean(), group.geometry.y.mean())
                 other_locs = other_locs.append(temp_loc, ignore_index=True)
 
-        other_locs = gpd.GeoDataFrame(other_locs, geometry='center', crs=stps.crs)
-        other_locs.set_index('id', inplace=True)
-        
-        assert all(other_locs['center'] == locs['center']), "The location geometry should be the same"
+        other_locs = gpd.GeoDataFrame(other_locs, geometry="center", crs=stps.crs)
+        other_locs.set_index("id", inplace=True)
+
+        assert all(other_locs["center"] == locs["center"]), "The location geometry should be the same"
         assert all(other_locs.index == locs.index), "The location id should be the same"
-    
+
     def test_generate_locations_dbscan_user_dataset(self):
-        stps_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-        stps = ti.read_staypoints_csv(stps_file, tz='utc', index_col='id')
+        stps_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+        stps = ti.read_staypoints_csv(stps_file, tz="utc", index_col="id")
         # take the first row and duplicate once
         stps = stps.head(1)
         stps = stps.append(stps, ignore_index=True)
         # assign a different user_id to the second row
         stps.iloc[1, 4] = 1
-        
-        # duplicate for a certain number 
-        stps = stps.append([stps]*5,ignore_index=True)
-        _, locs_ds = stps.as_staypoints.generate_locations(method='dbscan', epsilon=10, 
-                                                          num_samples=0, distance_matrix_metric='haversine',
-                                                          agg_level='dataset')
-        _, locs_us = stps.as_staypoints.generate_locations(method='dbscan', epsilon=10, 
-                                                          num_samples=0, distance_matrix_metric='haversine',
-                                                          agg_level='user')
+
+        # duplicate for a certain number
+        stps = stps.append([stps] * 5, ignore_index=True)
+        _, locs_ds = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=10, num_samples=0, distance_matrix_metric="haversine", agg_level="dataset"
+        )
+        _, locs_us = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=10, num_samples=0, distance_matrix_metric="haversine", agg_level="user"
+        )
         loc_ds_num = len(locs_ds.index.unique())
         loc_us_num = len(locs_us.index.unique())
         assert loc_ds_num == 1, "Considering all staypoints at once, there should be only one location"
         assert loc_us_num == 2, "Considering user staypoints separately, there should be two locations"
-    
+
     def test_generate_locations_dbscan_min(self):
-        pfs_file = os.path.join('tests', 'data', 'positionfixes.csv')
-        pfs = ti.read_positionfixes_csv(pfs_file, sep=';', tz='utc', index_col='id')
-        _, stps = pfs.as_positionfixes.generate_staypoints(method='sliding', dist_threshold=0, time_threshold=0)
-        _, locs_user = stps.as_staypoints.generate_locations(method='dbscan', epsilon=1e-18, 
-                                                            num_samples=0, agg_level='user')
-        _, locs_data = stps.as_staypoints.generate_locations(method='dbscan', epsilon=1e-18, 
-                                                            num_samples=0, agg_level='dataset')
+        pfs_file = os.path.join("tests", "data", "positionfixes.csv")
+        pfs = ti.read_positionfixes_csv(pfs_file, sep=";", tz="utc", index_col="id")
+        _, stps = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=0, time_threshold=0)
+        _, locs_user = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=1e-18, num_samples=0, agg_level="user"
+        )
+        _, locs_data = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=1e-18, num_samples=0, agg_level="dataset"
+        )
         assert len(locs_user) == len(stps), "With small hyperparameters, clustering should not reduce the number"
         assert len(locs_data) == len(stps), "With small hyperparameters, clustering should not reduce the number"
 
     def test_generate_locations_dbscan_max(self):
-        pfs_file = os.path.join('tests', 'data', 'positionfixes.csv')
-        pfs = ti.read_positionfixes_csv(pfs_file, sep=';', tz='utc', index_col='id')
-        _, stps = pfs.as_positionfixes.generate_staypoints(method='sliding', dist_threshold=0, time_threshold=0)
-        _, locs_user = stps.as_staypoints.generate_locations(method='dbscan', epsilon=1e18,
-                                                             num_samples=1000, agg_level='user')
-        _, locs_data = stps.as_staypoints.generate_locations(method='dbscan', epsilon=1e18,
-                                                             num_samples=1000, agg_level='dataset')
+        pfs_file = os.path.join("tests", "data", "positionfixes.csv")
+        pfs = ti.read_positionfixes_csv(pfs_file, sep=";", tz="utc", index_col="id")
+        _, stps = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=0, time_threshold=0)
+        _, locs_user = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=1e18, num_samples=1000, agg_level="user"
+        )
+        _, locs_data = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=1e18, num_samples=1000, agg_level="dataset"
+        )
         assert len(locs_user) == 0, "With large hyperparameters, every user location is an outlier"
         assert len(locs_data) == 0, "With large hyperparameters, every dataset location is an outlier"
-    
+
     def test_generate_locations_missing_link(self):
         """Test nan is assigned for missing link between stps and locs."""
-        pfs_file = os.path.join('tests', 'data', 'positionfixes.csv')
-        pfs = ti.read_positionfixes_csv(pfs_file, sep=';', tz='utc', index_col='id')
-        _, stps = pfs.as_positionfixes.generate_staypoints(method='sliding', dist_threshold=0, time_threshold=0)
-        stps, _ = stps.as_staypoints.generate_locations(method='dbscan', epsilon=1e18,
-                                                        num_samples=1000, agg_level='user')
-    
-        assert pd.isna(stps['location_id']).any()
-        
+        pfs_file = os.path.join("tests", "data", "positionfixes.csv")
+        pfs = ti.read_positionfixes_csv(pfs_file, sep=";", tz="utc", index_col="id")
+        _, stps = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=0, time_threshold=0)
+        stps, _ = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=1e18, num_samples=1000, agg_level="user"
+        )
+
+        assert pd.isna(stps["location_id"]).any()
+
     def test_generate_locations_dtype_consistent(self):
         """Test the dtypes for the generated columns."""
-        stps_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-        stps = ti.read_staypoints_csv(stps_file, tz='utc', index_col='id')
-        # 
-        stps, locs = stps.as_staypoints.generate_locations(method='dbscan', 
-                                                           epsilon=10, 
-                                                           num_samples=0, 
-                                                           distance_matrix_metric='haversine',
-                                                           agg_level='dataset')
-        assert stps['user_id'].dtype == locs['user_id'].dtype
-        assert stps['location_id'].dtype == 'Int64'
-        assert locs.index.dtype == 'int64'
+        stps_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+        stps = ti.read_staypoints_csv(stps_file, tz="utc", index_col="id")
+        #
+        stps, locs = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=10, num_samples=0, distance_matrix_metric="haversine", agg_level="dataset"
+        )
+        assert stps["user_id"].dtype == locs["user_id"].dtype
+        assert stps["location_id"].dtype == "Int64"
+        assert locs.index.dtype == "int64"
         # change the user_id to string
-        stps['user_id'] = stps['user_id'].apply(lambda x: str(x))
-        stps, locs = stps.as_staypoints.generate_locations(method='dbscan', 
-                                                           epsilon=10, 
-                                                           num_samples=0, 
-                                                           distance_matrix_metric='haversine',
-                                                           agg_level='dataset')
-        assert stps['user_id'].dtype == locs['user_id'].dtype
-        assert stps['location_id'].dtype == 'Int64'
-        assert locs.index.dtype == 'int64'
-        
+        stps["user_id"] = stps["user_id"].apply(lambda x: str(x))
+        stps, locs = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=10, num_samples=0, distance_matrix_metric="haversine", agg_level="dataset"
+        )
+        assert stps["user_id"].dtype == locs["user_id"].dtype
+        assert stps["location_id"].dtype == "Int64"
+        assert locs.index.dtype == "int64"
+
     def test_generate_locations_index_start(self):
         """Test the generated index start from 0 for different methods."""
-        stps_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-        stps = ti.read_staypoints_csv(stps_file, tz='utc', index_col='id')
-        
-        _, locs_ds = stps.as_staypoints.generate_locations(method='dbscan',
-                                                           epsilon=10,
-                                                           num_samples=0,
-                                                           distance_matrix_metric='haversine',
-                                                           agg_level='dataset')
-        _, locs_us = stps.as_staypoints.generate_locations(method='dbscan',
-                                                           epsilon=10,
-                                                           num_samples=0,
-                                                           distance_matrix_metric='haversine',
-                                                           agg_level='user')
-        
+        stps_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+        stps = ti.read_staypoints_csv(stps_file, tz="utc", index_col="id")
+
+        _, locs_ds = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=10, num_samples=0, distance_matrix_metric="haversine", agg_level="dataset"
+        )
+        _, locs_us = stps.as_staypoints.generate_locations(
+            method="dbscan", epsilon=10, num_samples=0, distance_matrix_metric="haversine", agg_level="user"
+        )
+
         assert (locs_ds.index == np.arange(len(locs_ds))).any()
         assert (locs_us.index == np.arange(len(locs_us))).any()
-        
-class TestCreate_activity_flag():
-    pass
\ No newline at end of file
+
+
+class TestCreate_activity_flag:
+    pass
diff --git a/tests/preprocessing/test_triplegs.py b/tests/preprocessing/test_triplegs.py
index 02306a8c..e5e76430 100644
--- a/tests/preprocessing/test_triplegs.py
+++ b/tests/preprocessing/test_triplegs.py
@@ -8,10 +8,10 @@
 import trackintel as ti
 
 
-class TestSmoothen_triplegs():
+class TestSmoothen_triplegs:
     def test_smoothen_triplegs(self):
-        tpls_file = os.path.join('tests', 'data', 'triplegs_with_too_many_points_test.csv')
-        tpls = ti.read_triplegs_csv(tpls_file, sep=';', index_col=None)
+        tpls_file = os.path.join("tests", "data", "triplegs_with_too_many_points_test.csv")
+        tpls = ti.read_triplegs_csv(tpls_file, sep=";", index_col=None)
         tpls_smoothed = ti.preprocessing.triplegs.smoothen_triplegs(tpls, tolerance=0.0001)
         line1 = tpls.iloc[0].geom
         line1_smoothed = tpls_smoothed.iloc[0].geom
@@ -25,17 +25,18 @@ def test_smoothen_triplegs(self):
         assert len(line1_smoothed.coords) == 4
         assert len(line2_smoothed.coords) == 3
 
-class TestGenerate_trips():
+
+class TestGenerate_trips:
     """Tests for generate_trips() method."""
-    
+
     def test_generate_trips(self):
         """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')
+        trips_loaded = ti.read_trips_csv(os.path.join("tests", "data", "geolife_long", "trips.csv"), index_col="id")
 
         # create trips from geolife (based on positionfixes)
-        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join('tests', 'data', 'geolife_long'))
-        pfs, stps = pfs.as_positionfixes.generate_staypoints(method='sliding', dist_threshold=25, time_threshold=5)
+        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife_long"))
+        pfs, stps = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=25, time_threshold=5)
         stps = stps.as_staypoints.create_activity_flag(time_threshold=15)
         pfs, tpls = pfs.as_positionfixes.generate_triplegs(stps)
 
@@ -43,58 +44,52 @@ def test_generate_trips(self):
         stps, tpls, trips = ti.preprocessing.triplegs.generate_trips(stps, tpls, gap_threshold=15)
         # test if generated trips are equal
         pd.testing.assert_frame_equal(trips_loaded, trips)
-        
+
     def test_generate_trips_missing_link(self):
         """Test nan is assigned for missing link between spts and trips, and tpls and trips."""
         # create trips from geolife (based on positionfixes)
-        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join('tests', 'data', 'geolife_long'))
-        pfs, stps = pfs.as_positionfixes.generate_staypoints(method='sliding',
-                                                             dist_threshold=25,
-                                                             time_threshold=5)
+        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife_long"))
+        pfs, stps = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=25, time_threshold=5)
         stps = stps.as_staypoints.create_activity_flag(time_threshold=15)
         pfs, tpls = pfs.as_positionfixes.generate_triplegs(stps)
 
         # generate trips and a joint staypoint/triplegs dataframe
         stps, tpls, _ = ti.preprocessing.triplegs.generate_trips(stps, tpls, gap_threshold=15)
-        assert pd.isna(stps['trip_id']).any()
-        assert pd.isna(stps['prev_trip_id']).any()
-        assert pd.isna(stps['next_trip_id']).any()
-        
+        assert pd.isna(stps["trip_id"]).any()
+        assert pd.isna(stps["prev_trip_id"]).any()
+        assert pd.isna(stps["next_trip_id"]).any()
+
     def test_generate_trips_dtype_consistent(self):
         """Test the dtypes for the generated columns."""
         # create trips from geolife (based on positionfixes)
-        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join('tests', 'data', 'geolife_long'))
-        pfs, stps = pfs.as_positionfixes.generate_staypoints(method='sliding',
-                                                             dist_threshold=25,
-                                                             time_threshold=5)
+        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife_long"))
+        pfs, stps = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=25, time_threshold=5)
         stps = stps.as_staypoints.create_activity_flag(time_threshold=15)
         pfs, tpls = pfs.as_positionfixes.generate_triplegs(stps)
 
         # generate trips and a joint staypoint/triplegs dataframe
         stps, tpls, trips = ti.preprocessing.triplegs.generate_trips(stps, tpls, gap_threshold=15)
-        
-        assert stps['user_id'].dtype == trips['user_id'].dtype
+
+        assert stps["user_id"].dtype == trips["user_id"].dtype
         assert trips.index.dtype == "int64"
-        
-        assert stps['trip_id'].dtype == "Int64"
-        assert stps['prev_trip_id'].dtype == "Int64"
-        assert stps['next_trip_id'].dtype == "Int64"
-        assert tpls['trip_id'].dtype == "Int64"
-    
+
+        assert stps["trip_id"].dtype == "Int64"
+        assert stps["prev_trip_id"].dtype == "Int64"
+        assert stps["next_trip_id"].dtype == "Int64"
+        assert tpls["trip_id"].dtype == "Int64"
+
     def test_generate_trips_index_start(self):
         """Test the generated index start from 0 for different methods."""
-        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join('tests', 'data', 'geolife_long'))
-        pfs, stps = pfs.as_positionfixes.generate_staypoints(method='sliding',
-                                                             dist_threshold=25,
-                                                             time_threshold=5)
+        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife_long"))
+        pfs, stps = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=25, time_threshold=5)
         stps = stps.as_staypoints.create_activity_flag(time_threshold=15)
         pfs, tpls = pfs.as_positionfixes.generate_triplegs(stps)
-        
+
         # generate trips and a joint staypoint/triplegs dataframe
         _, _, trips = ti.preprocessing.triplegs.generate_trips(stps, tpls, gap_threshold=15)
-        
+
         assert (trips.index == np.arange(len(trips))).any()
-        
+
     def test_generate_trips_gap_detection(self):
         """
         Test different gap cases:
@@ -111,33 +106,43 @@ def test_generate_trips_gap_detection(self):
         gap_threshold = 15
 
         # load data and add dummy geometry
-        stps_in = pd.read_csv(os.path.join('tests', 'data', 'trips', 'staypoints_gaps.csv'),
-                              sep=';', index_col='id', parse_dates=[0, 1],
-                              infer_datetime_format=True, dayfirst=True)
-        stps_in['geom'] = Point(1, 1)
-        stps_in = gpd.GeoDataFrame(stps_in, geometry='geom')
-        stps_in = ti.io.read_staypoints_gpd(stps_in, tz='utc')
+        stps_in = pd.read_csv(
+            os.path.join("tests", "data", "trips", "staypoints_gaps.csv"),
+            sep=";",
+            index_col="id",
+            parse_dates=[0, 1],
+            infer_datetime_format=True,
+            dayfirst=True,
+        )
+        stps_in["geom"] = Point(1, 1)
+        stps_in = gpd.GeoDataFrame(stps_in, geometry="geom")
+        stps_in = ti.io.read_staypoints_gpd(stps_in, tz="utc")
 
         assert stps_in.as_staypoints
 
-        tpls_in = pd.read_csv(os.path.join('tests', 'data', 'trips', 'triplegs_gaps.csv'),
-                              sep=';', index_col='id', parse_dates=[0, 1],
-                              infer_datetime_format=True, dayfirst=True)
-        tpls_in['geom'] = LineString([[1, 1], [2, 2]])
-        tpls_in = gpd.GeoDataFrame(tpls_in, geometry='geom')
-        tpls_in = ti.io.read_triplegs_gpd(tpls_in, tz='utc')
+        tpls_in = pd.read_csv(
+            os.path.join("tests", "data", "trips", "triplegs_gaps.csv"),
+            sep=";",
+            index_col="id",
+            parse_dates=[0, 1],
+            infer_datetime_format=True,
+            dayfirst=True,
+        )
+        tpls_in["geom"] = LineString([[1, 1], [2, 2]])
+        tpls_in = gpd.GeoDataFrame(tpls_in, geometry="geom")
+        tpls_in = ti.io.read_triplegs_gpd(tpls_in, tz="utc")
 
         assert tpls_in.as_triplegs
 
         # load ground truth data
-        trips_loaded = pd.read_csv(os.path.join('tests', 'data', 'trips', 'trips_gaps.csv'), index_col='id')
-        trips_loaded['started_at'] = pd.to_datetime(trips_loaded['started_at'], utc=True)
-        trips_loaded['finished_at'] = pd.to_datetime(trips_loaded['finished_at'], utc=True)
+        trips_loaded = pd.read_csv(os.path.join("tests", "data", "trips", "trips_gaps.csv"), index_col="id")
+        trips_loaded["started_at"] = pd.to_datetime(trips_loaded["started_at"], utc=True)
+        trips_loaded["finished_at"] = pd.to_datetime(trips_loaded["finished_at"], utc=True)
 
-        stps_tpls_loaded = pd.read_csv(os.path.join('tests', 'data', 'trips', 'stps_tpls_gaps.csv'), index_col='id')
-        stps_tpls_loaded['started_at'] = pd.to_datetime(stps_tpls_loaded['started_at'], utc=True)
-        stps_tpls_loaded['started_at_next'] = pd.to_datetime(stps_tpls_loaded['started_at_next'], utc=True)
-        stps_tpls_loaded['finished_at'] = pd.to_datetime(stps_tpls_loaded['finished_at'], utc=True)
+        stps_tpls_loaded = pd.read_csv(os.path.join("tests", "data", "trips", "stps_tpls_gaps.csv"), index_col="id")
+        stps_tpls_loaded["started_at"] = pd.to_datetime(stps_tpls_loaded["started_at"], utc=True)
+        stps_tpls_loaded["started_at_next"] = pd.to_datetime(stps_tpls_loaded["started_at_next"], utc=True)
+        stps_tpls_loaded["finished_at"] = pd.to_datetime(stps_tpls_loaded["finished_at"], utc=True)
 
         # generate trips and a joint staypoint/triplegs dataframe
         stps_proc, tpls_proc, trips = ti.preprocessing.triplegs.generate_trips(stps_in, tpls_in, gap_threshold=15)
@@ -148,17 +153,17 @@ def test_generate_trips_gap_detection(self):
 
         # test if generated staypoints/triplegs are equal (especially important for trip ids)
         pd.testing.assert_frame_equal(stps_tpls_loaded, spts_tpls, check_dtype=False)
-        
+
     def test_generate_trips_id_management(self):
         """Test if we can generate the example trips based on example data."""
-        stps_tpls_loaded = pd.read_csv(os.path.join('tests', 'data', 'geolife_long', 'stps_tpls.csv'), index_col='id')
-        stps_tpls_loaded['started_at'] = pd.to_datetime(stps_tpls_loaded['started_at'])
-        stps_tpls_loaded['started_at_next'] = pd.to_datetime(stps_tpls_loaded['started_at_next'])
-        stps_tpls_loaded['finished_at'] = pd.to_datetime(stps_tpls_loaded['finished_at'])
+        stps_tpls_loaded = pd.read_csv(os.path.join("tests", "data", "geolife_long", "stps_tpls.csv"), index_col="id")
+        stps_tpls_loaded["started_at"] = pd.to_datetime(stps_tpls_loaded["started_at"])
+        stps_tpls_loaded["started_at_next"] = pd.to_datetime(stps_tpls_loaded["started_at_next"])
+        stps_tpls_loaded["finished_at"] = pd.to_datetime(stps_tpls_loaded["finished_at"])
 
         # create trips from geolife (based on positionfixes)
-        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join('tests', 'data', 'geolife_long'))
-        pfs, stps = pfs.as_positionfixes.generate_staypoints(method='sliding', dist_threshold=25, time_threshold=5)
+        pfs, _ = ti.io.dataset_reader.read_geolife(os.path.join("tests", "data", "geolife_long"))
+        pfs, stps = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=25, time_threshold=5)
         stps = stps.as_staypoints.create_activity_flag(time_threshold=15)
         pfs, tpls = pfs.as_positionfixes.generate_triplegs(stps)
 
@@ -174,18 +179,18 @@ def test_generate_trips_id_management(self):
 def _create_debug_spts_tpls_data(stps, tpls, gap_threshold):
     """Preprocess stps and tpls for "test_generate_trips_*."""
     # create table with relevant information from triplegs and staypoints.
-    tpls['type'] = 'tripleg'
-    stps['type'] = 'staypoint'
-    stps_tpls = stps[['started_at', 'finished_at', 'user_id', 'type', 'activity', 'trip_id',
-                      'prev_trip_id', 'next_trip_id']].append(
-        tpls[['started_at', 'finished_at', 'user_id', 'type', 'trip_id']])
+    tpls["type"] = "tripleg"
+    stps["type"] = "staypoint"
+    stps_tpls = stps[
+        ["started_at", "finished_at", "user_id", "type", "activity", "trip_id", "prev_trip_id", "next_trip_id"]
+    ].append(tpls[["started_at", "finished_at", "user_id", "type", "trip_id"]])
 
     # transform nan to bool
-    stps_tpls['activity'] = stps_tpls['activity'] == True
-    stps_tpls.sort_values(by=['user_id', 'started_at'], inplace=True)
-    stps_tpls['started_at_next'] = stps_tpls['started_at'].shift(-1)
-    stps_tpls['activity_next'] = stps_tpls['activity'].shift(-1)
+    stps_tpls["activity"] = stps_tpls["activity"] == True
+    stps_tpls.sort_values(by=["user_id", "started_at"], inplace=True)
+    stps_tpls["started_at_next"] = stps_tpls["started_at"].shift(-1)
+    stps_tpls["activity_next"] = stps_tpls["activity"].shift(-1)
 
-    stps_tpls['gap'] = (stps_tpls['started_at_next'] - stps_tpls['finished_at']).dt.seconds / 60 > gap_threshold
+    stps_tpls["gap"] = (stps_tpls["started_at_next"] - stps_tpls["finished_at"]).dt.seconds / 60 > gap_threshold
 
-    return stps_tpls
\ No newline at end of file
+    return stps_tpls
diff --git a/tests/preprocessing/test_util.py b/tests/preprocessing/test_util.py
index 9726eafa..a9c995d8 100644
--- a/tests/preprocessing/test_util.py
+++ b/tests/preprocessing/test_util.py
@@ -15,7 +15,7 @@ def one_hour():
     return datetime.timedelta(hours=1)
 
 
-class TestCalc_temp_overlap():
+class TestCalc_temp_overlap:
     def test_same_interval(self, time_1, one_hour):
         """Two equal intervals should have 100 % overlap"""
         ratio = calc_temp_overlap(time_1, time_1 + one_hour, time_1, time_1 + one_hour)
diff --git a/tests/test_staypoints.py b/tests/test_staypoints.py
index b1eb601d..9cb6bc4a 100644
--- a/tests/test_staypoints.py
+++ b/tests/test_staypoints.py
@@ -8,14 +8,14 @@
 import trackintel as ti
 
 
-class TestCreate_activity_flag():
+class TestCreate_activity_flag:
     def test_create_activity_flag(self):
-        spts_file = os.path.join('tests', 'data', 'geolife', 'geolife_staypoints.csv')
-        spts_test = ti.read_staypoints_csv(spts_file, tz='utc', index_col='id')
+        spts_file = os.path.join("tests", "data", "geolife", "geolife_staypoints.csv")
+        spts_test = ti.read_staypoints_csv(spts_file, tz="utc", index_col="id")
 
-        activity_true = spts_test['activity'].copy()
-        spts_test['activity'] = False
+        activity_true = spts_test["activity"].copy()
+        spts_test["activity"] = False
 
         spts_test = spts_test.as_staypoints.create_activity_flag()
 
-        pd.testing.assert_series_equal(spts_test['activity'], activity_true)
+        pd.testing.assert_series_equal(spts_test["activity"], activity_true)
diff --git a/tests/test_visualization.py b/tests/test_visualization.py
index df67b96e..d8f4d888 100644
--- a/tests/test_visualization.py
+++ b/tests/test_visualization.py
@@ -2,7 +2,7 @@
 import os
 import matplotlib as mpl
 
-mpl.use('Agg')
+mpl.use("Agg")
 
 import trackintel as ti
 
@@ -11,9 +11,9 @@ class TestIO:
     def test_positionfixes_plot(self):
         """Use trackintel visualization function to plot positionfixes and check if file exists."""
 
-        tmp_file = os.path.join('tests', 'data', 'positionfixes_plot.png')
-        pfs_file = os.path.join('tests', 'data', 'positionfixes.csv')
-        pfs = ti.read_positionfixes_csv(pfs_file, sep=';', index_col='id', crs='EPSG:4326')
+        tmp_file = os.path.join("tests", "data", "positionfixes_plot.png")
+        pfs_file = os.path.join("tests", "data", "positionfixes.csv")
+        pfs = ti.read_positionfixes_csv(pfs_file, sep=";", index_col="id", crs="EPSG:4326")
         pfs.as_positionfixes.plot(out_filename=tmp_file, plot_osm=False)
         assert os.path.exists(tmp_file)
         os.remove(tmp_file)
@@ -21,12 +21,12 @@ def test_positionfixes_plot(self):
     def test_triplegs_plot(self):
         """Use trackintel visualization function to plot triplegs and check if file exists."""
 
-        tmp_file = os.path.join('tests', 'data', 'triplegs_plot.png')
-        pfs_file = os.path.join('tests', 'data', 'positionfixes.csv')
-        pfs = ti.read_positionfixes_csv(pfs_file, sep=';', index_col='id', crs='EPSG:4326')
+        tmp_file = os.path.join("tests", "data", "triplegs_plot.png")
+        pfs_file = os.path.join("tests", "data", "positionfixes.csv")
+        pfs = ti.read_positionfixes_csv(pfs_file, sep=";", index_col="id", crs="EPSG:4326")
 
-        tpls_file = os.path.join('tests', 'data', 'triplegs.csv')
-        tpls = ti.read_triplegs_csv(tpls_file, sep=';', index_col='id', crs='EPSG:4326')
+        tpls_file = os.path.join("tests", "data", "triplegs.csv")
+        tpls = ti.read_triplegs_csv(tpls_file, sep=";", index_col="id", crs="EPSG:4326")
         tpls.as_triplegs.plot(out_filename=tmp_file, positionfixes=pfs, plot_osm=False)
         assert os.path.exists(tmp_file)
         os.remove(tmp_file)
@@ -34,12 +34,12 @@ def test_triplegs_plot(self):
     def test_staypoints_plot(self):
         """Use trackintel visualization function to plot staypoints and check if file exists."""
 
-        tmp_file = os.path.join('tests', 'data', 'staypoints_plot.png')
-        pfs_file = os.path.join('tests', 'data', 'positionfixes.csv')
-        pfs = ti.read_positionfixes_csv(pfs_file, sep=';', index_col='id', crs='EPSG:4326')
+        tmp_file = os.path.join("tests", "data", "staypoints_plot.png")
+        pfs_file = os.path.join("tests", "data", "positionfixes.csv")
+        pfs = ti.read_positionfixes_csv(pfs_file, sep=";", index_col="id", crs="EPSG:4326")
 
-        stps_file = os.path.join('tests', 'data', 'staypoints.csv')
-        stps = ti.read_staypoints_csv(stps_file, sep=';', index_col='id', crs='EPSG:4326')
+        stps_file = os.path.join("tests", "data", "staypoints.csv")
+        stps = ti.read_staypoints_csv(stps_file, sep=";", index_col="id", crs="EPSG:4326")
         stps.as_staypoints.plot(out_filename=tmp_file, radius=0.01, positionfixes=pfs, plot_osm=False)
         assert os.path.exists(tmp_file)
         os.remove(tmp_file)
@@ -48,13 +48,14 @@ def test_locations_plot(self):
         """Use trackintel visualization function to plot locations and check if file exists."""
 
         tmp_file = os.path.join("tests", "data", "locations_plot.png")
-        pfs_file = os.path.join('tests', 'data', 'positionfixes.csv')
-        pfs = pfs = ti.read_positionfixes_csv(pfs_file, sep=';', index_col='id', crs='EPSG:4326')
-        stps_file = os.path.join('tests', 'data', 'staypoints.csv')
-        stps = ti.read_staypoints_csv(stps_file, sep=';', index_col='id', crs='EPSG:4326')
-        locs_file = os.path.join('tests', 'data', 'locations.csv')
-        locs = ti.read_locations_csv(locs_file, sep=';', index_col='id', crs='EPSG:4326')
-        locs.as_locations.plot(out_filename=tmp_file, radius=120, positionfixes=pfs,
-                               staypoints=stps, staypoints_radius=100, plot_osm=False)
+        pfs_file = os.path.join("tests", "data", "positionfixes.csv")
+        pfs = pfs = ti.read_positionfixes_csv(pfs_file, sep=";", index_col="id", crs="EPSG:4326")
+        stps_file = os.path.join("tests", "data", "staypoints.csv")
+        stps = ti.read_staypoints_csv(stps_file, sep=";", index_col="id", crs="EPSG:4326")
+        locs_file = os.path.join("tests", "data", "locations.csv")
+        locs = ti.read_locations_csv(locs_file, sep=";", index_col="id", crs="EPSG:4326")
+        locs.as_locations.plot(
+            out_filename=tmp_file, radius=120, positionfixes=pfs, staypoints=stps, staypoints_radius=100, plot_osm=False
+        )
         assert os.path.exists(tmp_file)
         os.remove(tmp_file)
diff --git a/tests/visualization/test_modal_split.py b/tests/visualization/test_modal_split.py
index 5f48bcbf..6db33412 100644
--- a/tests/visualization/test_modal_split.py
+++ b/tests/visualization/test_modal_split.py
@@ -13,11 +13,9 @@
 @pytest.fixture
 def get_geolife_triplegs_with_modes():
     """Get modal split for a small part of the geolife dataset."""
-    pfs, labels = read_geolife(os.path.join('tests', 'data', 'geolife_modes'))
-    pfs, spts = pfs.as_positionfixes.generate_staypoints(method='sliding',
-                                                         dist_threshold=25,
-                                                         time_threshold=5)
-    _, tpls = pfs.as_positionfixes.generate_triplegs(spts, method='between_staypoints')
+    pfs, labels = read_geolife(os.path.join("tests", "data", "geolife_modes"))
+    pfs, spts = pfs.as_positionfixes.generate_staypoints(method="sliding", dist_threshold=25, time_threshold=5)
+    _, tpls = pfs.as_positionfixes.generate_triplegs(spts, method="between_staypoints")
 
     tpls_with_modes = geolife_add_modes_to_triplegs(tpls, labels)
     return tpls_with_modes
@@ -27,14 +25,14 @@ def get_geolife_triplegs_with_modes():
 def get_test_triplegs_with_modes():
     """Get modal split for randomly generated data."""
     n = 200
-    day_1_h1 = pd.Timestamp('1970-01-01 00:00:00', tz='utc')
+    day_1_h1 = pd.Timestamp("1970-01-01 00:00:00", tz="utc")
     one_day = datetime.timedelta(days=1)
-    mode_list = ['car', 'walk', 'train', 'bus', 'bike', 'walk', 'bike']
+    mode_list = ["car", "walk", "train", "bus", "bike", "walk", "bike"]
     df = pd.DataFrame(index=np.arange(n))
-    df['mode'] = np.random.choice(mode_list, n)
-    df['user_id'] = (np.random.randint(1, 5, size=n))
-    df['started_at'] = (np.random.randint(1, 30, size=n) * one_day)
-    df['started_at'] = df['started_at'] + day_1_h1
+    df["mode"] = np.random.choice(mode_list, n)
+    df["user_id"] = np.random.randint(1, 5, size=n)
+    df["started_at"] = np.random.randint(1, 30, size=n) * one_day
+    df["started_at"] = df["started_at"] + day_1_h1
 
     return df
 
@@ -42,7 +40,7 @@ def get_test_triplegs_with_modes():
 class TestPlot_modal_split:
     def test_create_plot_geolife(self, get_geolife_triplegs_with_modes):
         """Check if we can run the plot function with geolife data without error"""
-        modal_split = calculate_modal_split(get_geolife_triplegs_with_modes, freq='d', per_user=False)
+        modal_split = calculate_modal_split(get_geolife_triplegs_with_modes, freq="d", per_user=False)
         plot_modal_split(modal_split)
         assert True
 
@@ -58,26 +56,27 @@ def test_check_dtype_error(self, get_geolife_triplegs_with_modes):
 
     def test_multi_user_error(self, get_test_triplegs_with_modes):
         """Create a modal split plot based on randomly generated test data"""
-        modal_split = calculate_modal_split(get_test_triplegs_with_modes, freq='d', per_user=True, norm=True)
+        modal_split = calculate_modal_split(get_test_triplegs_with_modes, freq="d", per_user=True, norm=True)
         with pytest.raises(ValueError):
             plot_modal_split(modal_split)
 
         # make sure that there is no error if the data was correctly created
-        modal_split = calculate_modal_split(get_test_triplegs_with_modes, freq='d', per_user=False, norm=True)
+        modal_split = calculate_modal_split(get_test_triplegs_with_modes, freq="d", per_user=False, norm=True)
         plot_modal_split(modal_split)
 
         assert True
 
     def test_create_plot_testdata(self, get_test_triplegs_with_modes):
         """Create a modal split plot based on randomly generated test data"""
-        tmp_file = os.path.join('tests', 'data', 'modal_split_plot.png')
+        tmp_file = os.path.join("tests", "data", "modal_split_plot.png")
 
-        modal_split = calculate_modal_split(get_test_triplegs_with_modes, freq='d', per_user=False, norm=True)
+        modal_split = calculate_modal_split(get_test_triplegs_with_modes, freq="d", per_user=False, norm=True)
 
-        modal_split = modal_split[['walk', 'bike', 'train', 'car', 'bus']]  # change order for the looks of the plot
-        plot_modal_split(modal_split, out_path=tmp_file, date_fmt_x_axis='%d',
-                         y_label='Percentage of daily count', x_label='days')
+        modal_split = modal_split[["walk", "bike", "train", "car", "bus"]]  # change order for the looks of the plot
+        plot_modal_split(
+            modal_split, out_path=tmp_file, date_fmt_x_axis="%d", y_label="Percentage of daily count", x_label="days"
+        )
 
         assert os.path.exists(tmp_file)
         os.remove(tmp_file)
-        os.remove(tmp_file.replace('png', 'pdf'))
+        os.remove(tmp_file.replace("png", "pdf"))
diff --git a/tests/visualization/test_util.py b/tests/visualization/test_util.py
index 7f245883..b44af16a 100644
--- a/tests/visualization/test_util.py
+++ b/tests/visualization/test_util.py
@@ -9,8 +9,8 @@ class TestTransform_gdf_to_wgs84:
     def test_transformation(self):
         """Check if data gets transformed."""
 
-        file = os.path.join('tests', 'data', 'positionfixes.csv')
-        pfs = ti.read_positionfixes_csv(file, sep=';', crs='EPSG:4326', index_col=None)
+        file = os.path.join("tests", "data", "positionfixes.csv")
+        pfs = ti.read_positionfixes_csv(file, sep=";", crs="EPSG:4326", index_col=None)
         pfs_2056 = pfs.to_crs("EPSG:2056")
         pfs_4326 = ti.visualization.util.transform_gdf_to_wgs84(pfs_2056)
         assert_geodataframe_equal(pfs, pfs_4326, check_less_precise=True)
@@ -18,7 +18,7 @@ def test_transformation(self):
     def test_crs_warning(self):
         """Check if warning is raised for data without crs."""
 
-        file = os.path.join('tests', 'data', 'positionfixes.csv')
-        pfs = ti.read_positionfixes_csv(file, sep=';', crs=None, index_col=None)
+        file = os.path.join("tests", "data", "positionfixes.csv")
+        pfs = ti.read_positionfixes_csv(file, sep=";", crs=None, index_col=None)
         with pytest.warns(UserWarning):
             ti.visualization.util.transform_gdf_to_wgs84(pfs)