# pointpats.weighted_mean_center

pointpats.weighted_mean_center(points, weights)
pointpats.weighted_mean_center(points: ndarray, weights: Sequence) → ndarray[tuple[Any, ...], dtype[float64]]
pointpats.weighted_mean_center(points: GeoPandasBase, weights) → Point

  Find weighted mean center of a marked point pattern.

  Parameters:
    points arraylike

      array representing a point pattern

    weights arraylike

      a series of attribute values of length n.

  Returns:
    center

      center of a given point pattern

  Examples

      >>> import numpy as np
      >>> import geopandas as gpd

  Create an array of point coordinates.

      >>> coords = np.array(
      ...     [
      ...         [66.22, 32.54],
      ...         [22.52, 22.39],
      ...         [31.01, 81.21],
      ...         [9.47, 31.02],
      ...         [30.78, 60.10],
      ...         [75.21, 58.93],
      ...         [79.26, 7.68],
      ...         [8.23, 39.93],
      ...         [98.73, 77.17],
      ...         [89.78, 42.53],
      ...         [65.19, 92.08],
      ...         [54.46, 8.48],
      ...     ]
      ... )
      >>> weight = np.arange(1, 13, 1)

  Passing an array of coordinates returns an array capturing the center.

      >>> weighted_mean_center(coords, weight)
      array([59.29448718, 47.52282051])

  Passing a GeoPandas object returns a shapely geometry.

      >>> geoms = gpd.GeoSeries.from_xy(*coords.T)
      >>> weighted_mean_center(geoms, weight)
      <POINT (59.294 47.523)>