set_list_column#
- NestSeriesAccessor.set_list_column(column: str, value: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]) NestedSeries[source]#
Set the field from list-array of values and return a new series
- Parameters:
column (str) – Name of the column to set. If not present, it will be added.
value (ArrayLike) – Array of values to set. It must be a list-array of the same length as the series.
- Returns:
The new series with the field set.
- Return type:
Examples
>>> from nested_pandas.datasets.generation import generate_data >>> nf = generate_data(2, 2, seed=1)
>>> nf_new_band = nf["nested"].nest.set_list_column("new_band", ... [["g","g"], ... ["r","r"]]) >>> # Look at one row of the series >>> nf_new_band[0] t flux flux_error band new_band 0 2.935118 39.676747 1.0 g g 1 3.725204 41.919451 1.0 r g