vibespatial.api.tabular

Public numeric reductions that preserve device-backed pandas Series.

Functions

dense_count(→ pandas.Series)

Count non-negative integer codes into a fixed-size dense Series.

dense_sum(→ pandas.Series)

Sum numeric values by fixed-domain non-negative integer codes.

dense_grouped_reduce(→ pandas.DataFrame)

Reduce count and named numeric sums into one fixed-domain device state.

numeric_take(→ pandas.Series)

Gather numeric values by integer positions into a real pandas Series.

Module Contents

vibespatial.api.tabular.dense_count(codes, *, size: int, dtype: Any = np.uint32, name: Any = None, out: pandas.Series | None = None) → pandas.Series

Count non-negative integer codes into a fixed-size dense Series.

This is the fixed-domain counterpart of numpy.bincount. codes must be one-dimensional and every value must be in [0, size). Device-backed vibeSpatial expressions produce a device-backed real pandas Series. When out is supplied, the batch is added transactionally to that same Series without allocating another fixed-domain vector. The accumulator must have exactly the requested unsigned dtype, length, and RangeIndex(size), and its residency must match the selected execution mode. Overflow raises before any counters from the batch are changed. Device-backed codes and out must not overlap because the update reads codes while mutating counters.

vibespatial.api.tabular.dense_sum(codes, values, *, size: int, dtype: Any = np.float64, name: Any = None) → pandas.Series

Sum numeric values by fixed-domain non-negative integer codes.

This is the weighted counterpart of dense_count(). Missing floating values are skipped, matching pandas grouped-sum behavior, and empty groups contain zero. Device-backed expressions remain a device-backed real pandas Series so bounded grouped states can be merged before terminal export.

vibespatial.api.tabular.dense_grouped_reduce(codes, *, size: int, sums: collections.abc.Mapping[Any, Any], count_name: Any | None = None, count_dtype: Any = np.uint64, sum_dtype: Any = np.float64, out: pandas.DataFrame | None = None) → pandas.DataFrame

Reduce count and named numeric sums into one fixed-domain device state.

Code-domain validation and index conversion are shared across every output column. The returned object is a real pandas DataFrame whose columns remain device-backed until an explicit public export. When out is an earlier device-backed result with the same fixed domain and columns, reductions are accumulated into its existing vectors and that same frame is returned.

vibespatial.api.tabular.numeric_take(values, indices, *, name: Any = None) → pandas.Series

Gather numeric values by integer positions into a real pandas Series.