fips.Vector.combine_first#
- Vector.combine_first(other)[source]#
Return other with this vector’s values where this vector has the label.
The values of a smaller vector put back on a larger space: the estimate of a problem restricted to some of the state (
Problem.restrict), on the whole state, with the prior where the state was held at it.- Parameters:
other (
Vector) – The values for the labels this vector lacks. Every label of this vector must be one of other’s.- Returns:
On other’s space, named as this vector.
- Return type:
- Raises:
ValueError – If this vector has a block or a label other lacks.
Examples
>>> import pandas as pd >>> from fips import Vector >>> cells = pd.Index(["a", "b", "c"], name="cell") >>> prior = Vector.from_series( ... pd.Series([1.0, 2.0, 3.0], index=cells), block="flux" ... ) >>> part = Vector.from_series( ... pd.Series([20.0], index=cells[[1]], name="estimate"), block="flux" ... ) >>> part.combine_first(prior).values array([ 1., 20., 3.])