iode.Identities.from_series

Identities.from_series(s: Series)[source]

Copy the pandas Series s into the IODE Identities database. The identity names to copy are deduced from the index of the Series.

Parameters:
s: Series

pandas Series containing the identities to copy into the IODE Identities database.

Notes

The index of the passed Series is sorted in alphabetical order before copying to IODE Identities database.

Examples

>>> from iode import identities
>>> import pandas as pd
>>> identities.clear()
>>> len(identities)
0
>>> # create the pandas Series
>>> names = ["CONST", "LOG_T", "EXP_T", "GRT_T", "MAVG_T", "DER_LOG_T"]
>>> data = ["1", "ln t", "exp t", "grt t", "mavg t", "d(ln t)"]
>>> s = pd.Series(data=data, index=names, dtype=str, name="Identities")
>>> # display the pandas series
>>> s
CONST              1
LOG_T           ln t
EXP_T          exp t
GRT_T          grt t
MAVG_T        mavg t
DER_LOG_T    d(ln t)
Name: Identities, dtype: object
>>> # load into the IODE Identities database
>>> identities.from_series(s)
>>> len(identities)
6
>>> identities.names
['CONST', 'DER_LOG_T', 'EXP_T', 'GRT_T', 'LOG_T', 'MAVG_T']
>>> identities["LOG_T"]
Identity('ln t')
>>> identities["DER_LOG_T"]
Identity('d(ln t)')