Open ennoToUpper opened 1 year ago
As we are having B columns in both dfs and if we wanna do join, here we could explicitly specify joined_df = gdf1.sjoin_nearest(gdf2, lsuffix=suffix_left, rsuffix=suffix_right, how="inner") it good to lsuffix=suffix_left variable suffix rather than lsuffix=left which is fixed
[x] I have checked that this issue has not already been reported.
[x] I have confirmed this bug exists on the latest version of geopandas.
[ ] (optional) I have confirmed this bug exists on the main branch of geopandas.
Code Sample, a copy-pastable example
Problem description
Currently sjoinnearest adds a '_' between the column name and the suffix while merge does not. The behaviour should be consistent between the functions that have a somewhat similiar behaviour otherwise. The '' gets added at line 263 in sjoin.py.
The way the parameters are passed is also not consistent. sjoin_nearest uses separate named arguments while merge does not. Both sjoin_nearest and merge declare in their description that they both add 2 gdfs toghether.
Finally I would like to add that sjoin -like merge- is not user friendly as it takes the arguments in the form of *args and **kwargs making it hard to know what are valid arguments. This combined with the inconsistent suffix appending creates issues that are unpredictable.
Expected Output
Either both ways add the "_" or both don't.
.sjoin_nearest(gdf, suffixes=[...]
Output of
geopandas.show_versions()