iode.Sample.get_period_list

Sample.get_period_list(astype: _AnyMeta | str = <class 'str'>) List[Any][source]

List of all periods of the sample. Periods are exported as string (default) or as float.

Parameters:
astype: type or str

Allowed returned type for periods are: ‘str’, ‘float’, ‘Period’. Default to str.

Returns:
list(str) or list(float)

Examples

>>> from iode import variables, SAMPLE_DATA_DIR
>>> variables.load(f"{SAMPLE_DATA_DIR}/fun.var")
Loading .../fun.var
394 objects loaded
>>> variables.sample.get_period_list()
['1960Y1', '1961Y1', ..., '2014Y1', '2015Y1']
>>> variables.sample.get_period_list(astype=float)
[1960.0, 1961.0, ..., 2014.0, 2015.0]
>>> variables.sample.get_period_list(astype=Period)
[Period("1960Y1"), Period("1961Y1"), ..., Period("2014Y1"), Period("2015Y1")]