iode.Scalars.from_series
- Scalars.from_series(s: Series)[source]
Copy the pandas Series s into the IODE Scalars database. The scalar names to copy are deduced from the index of the Series.
- Parameters:
- s: Series
pandas Series containing the scalars values to copy into the Scalars database. The ‘relax’ value of all scalars will be set to 1.
See also
Notes
The index of the passed Series is sorted in alphabetical order before copying to IODE Scalars database.
Examples
>>> from iode import scalars >>> import pandas as pd >>> scalars.clear() >>> len(scalars) 0
>>> # create the pandas Series >>> data = {"alpha_0": 0.9, "alpha_1": 0.1, "alpha_": 5.5, ... "beta_0": 0.9, "beta_1": 0.01, "beta_": 3.6} >>> s = pd.Series(data, dtype="float64") >>> # display the pandas series >>> s alpha_0 0.90 alpha_1 0.10 alpha_ 5.50 beta_0 0.90 beta_1 0.01 beta_ 3.60 dtype: float64
>>> # load into the IODE Scalars database >>> scalars.from_series(s) >>> len(scalars) 6
>>> scalars.names ['alpha_', 'alpha_0', 'alpha_1', 'beta_', 'beta_0', 'beta_1'] >>> scalars["alpha_1"] Scalar(0.1, 1, na) >>> scalars["beta_"] Scalar(3.6, 1, na)