martin-ueding / geo-activity-playground

Data analysis and visualization based on GPS tracked outdoor activities.
https://martin-ueding.github.io/geo-activity-playground/
MIT License
35 stars 14 forks source link

gemeinsame Aktivitäten #142

Closed Hanfbaum closed 3 months ago

Hanfbaum commented 3 months ago

Ich glaube es gibt Probleme bei Aktivitäten, die gemeinsam stattgefunden haben.

E:\Martin\Playground_Strava>python -m geo_activity_playground serve
Import from Strava export: 0it [00:00, ?it/s]
Downloading Strava activities: 0it [00:00, ?it/s]
Enrich new activity data:   0%|                                                               | 0/2306 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\groupby\groupby.py", line 1770, in apply
    result = self._python_apply_general(f, self._selected_obj)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\groupby\groupby.py", line 1819, in _python_apply_general
    values, mutated = self.grouper.apply_groupwise(f, data, self.axis)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\groupby\ops.py", line 911, in apply_groupwise
    res = f(group)
          ^^^^^^^^
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\groupby\groupby.py", line 1758, in f
    return func(g, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: _compute_moving_time.<locals>.moving_time() got an unexpected keyword argument 'include_groups'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\__main__.py", line 116, in <module>
    main()
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\__main__.py", line 92, in main
    options.func(options)
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\__main__.py", line 66, in <lambda>
    *make_activity_repository(options.basedir, options.skip_strava),
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\__main__.py", line 110, in make_activity_repository
    scan_for_activities(repository, tile_visit_accessor, config, skip_strava)
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\webui\upload\controller.py", line 105, in scan_for_activities
    enrich_activities(config.get("kind", {}))
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\core\enrichment.py", line 72, in enrich_activities
    metadata.update(_get_metadata_from_timeseries(time_series))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\core\enrichment.py", line 93, in _get_metadata_from_timeseries
    metadata["moving_time"] = _compute_moving_time(timeseries)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\geo_activity_playground\core\enrichment.py", line 110, in _compute_moving_time
    time_series.groupby("segment_id").apply(moving_time, include_groups=False).sum()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\groupby\groupby.py", line 1780, in apply
    return self._python_apply_general(f, self._obj_with_exclusions)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\groupby\groupby.py", line 1819, in _python_apply_general
    values, mutated = self.grouper.apply_groupwise(f, data, self.axis)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\groupby\ops.py", line 911, in apply_groupwise
    res = f(group)
          ^^^^^^^^
  File "C:\Users\Hanfbaum\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pandas\core\groupby\groupby.py", line 1758, in f
    return func(g, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: _compute_moving_time.<locals>.moving_time() got an unexpected keyword argument 'include_groups'

E:\Martin\Playground_Strava>pause
Drücken Sie eine beliebige Taste . . .
martin-ueding commented 3 months ago

Du meinst wegen dem include_groups? Das kommt von anderer Stelle, kann ich aber zuordnen.

martin-ueding commented 3 months ago

Das Problem ist, dass apply die Option include_groups erst ab Pandas 2.2.0 hat. Im Projekt ist aber als Version nur >= 2.0 vorgegeben. Ich gehe davon aus, dass bei dir die Version von Pandas älter ist. In der nächsten Version ist dann die Abhängigkeit zu Pandas explizit erhöht, womit sich das dann erledigen sollte.