Skip to content

bug: algorithm crash pandas.errors.InvalidIndexError: Reindexing only valid with uniquely valued Index objects #186

@garobrik

Description

@garobrik
Traceback #11, occurred 1 times. Example pedon: 7056, lat: 39.9782257, lon: -119.2501602
  Traceback (most recent call last):
    File "/home/roux/projects/terraso/soil-id-algorithm/soil_id/tests/us/generate_bulk_test_results.py", line 53, in <module>
      lat = pedon["y"].values[0]
                        ~~~~~^^^
    File "/home/roux/projects/terraso/soil-id-algorithm/soil_id/us_soil.py", line 315, in list_soils
      pd.concat([group_sorted, layer]).sort_values("hzdept_r").reset_index(drop=True)
      ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/roux/projects/terraso/soil-id-algorithm/.venv/lib/python3.13/site-packages/pandas/core/reshape/concat.py", line 395, in concat
      return op.get_result()
             ~~~~~~~~~~~~~^^
    File "/home/roux/projects/terraso/soil-id-algorithm/.venv/lib/python3.13/site-packages/pandas/core/reshape/concat.py", line 680, in get_result
      indexers[ax] = obj_labels.get_indexer(new_labels)
                     ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
    File "/home/roux/projects/terraso/soil-id-algorithm/.venv/lib/python3.13/site-packages/pandas/core/indexes/base.py", line 3885, in get_indexer
      raise InvalidIndexError(self._requires_unique_msg)
  pandas.errors.InvalidIndexError: Reindexing only valid with uniquely valued Index objects

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions