Skip to content

Fix pandas warning in sitemap harvester

When running tests, pandas currently issues a warning:

tests/test_sitemap_harvester.py::test_filter_urls
  /local/home/a.pirogov/projects/data_harvesting/data_harvesting/harvester/sitemap.py:69: SettingWithCopyWarning: 
  A value is trying to be set on a copy of a slice from a DataFrame.
  Try using .loc[row_indexer,col_indexer] = value instead
  
  See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
    sub_df['lastmod_date'] = pd.to_datetime(sub_df['lastmod']).dt.date

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

That should be easy to fix and probably should be fixed to avoid breakage in the future (changes in pandas semantics etc. described in the linked docs pages).