A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Esri/arcgis-python-api/issues/2214 below:

Incorrect match_field column renaming · Issue #2214 · Esri/arcgis-python-api · GitHub

Describe the bug

Whatever column you use as the match_field gets truncated in the output when using GeoAccessor.compare

'global_join' --> becomes --> 'global_'

'test' --> becomes --> ' ' (it returns empty)

To Reproduce

differences = archive_sdf.spatial.compare(current_sdf, match_field='global_join')

change_log = {
    "modified": len(differences['modified_rows']['global_join']),
    "inserted": len(differences['added_rows']['global_join']),
    "deleted": len(differences['deleted_rows']['global_join'])
}

error:

"deleted": len(differences['deleted_rows']['global_join'])
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "...\Python\envs\arcgispro-py3\Lib\site-packages\pandas\core\frame.py", line 3761, in __getitem__
indexer = self.columns.get_loc(key)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\Python\envs\arcgispro-py3\Lib\site-packages\pandas\core\indexes\base.py", line 3654, in get_loc
raise KeyError(key) from err
KeyError: 'global_join'

Screenshots

Expected behavior

the input match_field name should not change. If you input "global_join" the resulting dictionary should have a "global_join"

Platform (please complete the following information):

Additional context

This may be the cause:

field names are renamed in the 2.4.0 version of the _assessor.py file using

new_column_name = column[: -len("_new")] 
new_column_name = column[: -len("_old")]

it is removing 4 characters for all columns including match_field

in an older version of the API this was used instead

column.rstrip("_new") 
column.rstrip("_old")

The logic needs to be adjusted so that only the "_new" or "_old" suffix is removed from the appropriate columns and not the match_field.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4