iode.Scalars.to_frame

Scalars.to_frame() DataFrame[source]

Create a pandas DataFrame from the current Scalars database. The index of the returned DataFrame is build from the Scalars names.

Examples

>>> from iode import SAMPLE_DATA_DIR, scalars
>>> import pandas as pd
>>> scalars.load(f"{SAMPLE_DATA_DIR}/fun.scl")
Loading .../fun.scl
161 objects loaded 
>>> len(scalars)
161
>>> # Export the IODE Scalars database as a pandas DataFrame
>>> df = scalars.to_frame()
>>> len(df)
161
>>> df.index.to_list()
['acaf1', 'acaf2', 'acaf3', ..., 'zkf1', 'zkf2', 'zkf3']
>>> scalars["acaf1"]
Scalar(0.0157684, 1, 0.00136871)
>>> df.loc["acaf1"]
value    0.015768
relax    1.000000
std      0.001369
Name: acaf1, dtype: float64
>>> scalars["qc0_"]
Scalar(0.178165, 1, 0.102838)
>>> df.loc["qc0_"]
value    0.178165
relax    1.000000
std      0.102838
Name: qc0_, dtype: float64
>>> # Export a subset of the IODE Scalars database as a pandas DataFrame
>>> df = scalars["a*;*_"].to_frame()
>>> len(df)
19
>>> df.index.to_list()
['acaf1', 'acaf2', 'acaf3', ..., 'vs1_', 'vs2_', 'vs3_']
>>> scalars["acaf1"]
Scalar(0.0157684, 1, 0.00136871)
>>> df.loc["acaf1"]
value    0.015768
relax    1.000000
std      0.001369
Name: acaf1, dtype: float64
>>> scalars["qc0_"]
Scalar(0.178165, 1, 0.102838)
>>> df.loc["qc0_"]
value    0.178165
relax    1.000000
std      0.102838
Name: qc0_, dtype: float64