Skip to content

[GH-3475] Correct the GeoStats Python docstrings - #3476

Merged
jiayuasu merged 1 commit into
apache:masterfrom
jiayuasu:fix/geostats-python-docstrings
Oct 18, 2026
Merged

jiayuasu merged 1 commit into
apache:masterfrom
jiayuasu:fix/geostats-python-docstrings

Conversation

@jiayuasu

Copy link
Copy Markdown
Member

Did you read the Contributor Guide?

Is this PR related to a ticket?

What changes were proposed in this PR?

Docstring-only changes in python/sedona/spark/stats:

  • Moran, Moran.get_global and MoranResult: new docstrings. They describe the input get_global needs (an id column, a numeric value column, and a column named weights whose neighbors carry the id and value columns, for example from add_distance_band_column with saved_attributes) and the three result fields.
  • dbscan: include_outliers defaults to True.
  • g_local: point to sedona.spark.stats.weighting.add_distance_band_column, say that include_self=True puts the focal observation in its neighbors for Gi*, and name the added columns EG and VG as the Scala code does.
  • weighting: the new column is named by result_name ('weights' by default), not 'cluster'. add_weighted_distance_band_column weights are dist^alpha and alpha is required. Only weighted distances with a negative alpha give infinite weights, so add_binary_distance_band_column no longer mentions them.
  • A blank line before Returns: in add_distance_band_column and g_local, so docstring parsers such as griffe read it as a section.

How was this patch tested?

  • Checked each statement against the Scala implementations (DBSCAN, GetisOrd, Weighting, Moran).
  • Parsed the module with griffe: every function and class now has its parameters and returns documented, with no section warnings.
  • pre-commit run on the changed files passes, and the files compile.

Did this PR include necessary documentation updates?

  • Yes, this PR updates the Python docstrings.

- Moran and MoranResult had no docstrings.
- dbscan: include_outliers defaults to True, not False.
- g_local: point to sedona.spark.stats.weighting.add_distance_band_column
  instead of a module that does not exist, and name the output columns
  EG and VG as they are added.
- weighting: the new column is named by result_name, not 'cluster';
  add_weighted_distance_band_column weights are dist^alpha and alpha has
  no default; only weighted distances can give infinite weights. Add the
  blank line griffe needs before Returns.
@jiayuasu
jiayuasu merged commit 39a5955 into apache:master Oct 18, 2026
34 checks passed
@jiayuasu
jiayuasu deleted the fix/geostats-python-docstrings branch October 18, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GeoStats Python docstrings are missing or wrong

1 participant