Dfs0
self, filename) Dfs0(
Attributes
Name | Description |
---|---|
items | List of items. |
n_items | Number of items. |
n_timesteps | Number of time steps. |
start_time | File start time. |
time | File all datetimes. |
timestep | Time step size in seconds. |
Methods
Name | Description |
---|---|
from_dataframe | Create a dfs0 from a pandas Dataframe. |
read | Read data from a dfs0 file. |
to_dataframe | Read data from the dfs0 file and return a Pandas DataFrame. |
from_dataframe
=None, unit=None, items=None) Dfs0.from_dataframe(df, filename, itemtype
Create a dfs0 from a pandas Dataframe.
Parameters
Name | Type | Description | Default |
---|---|---|---|
df | pd.DataFrame | Dataframe with data | required |
filename | str | filename to write output | required |
itemtype | EUMType | None | Same type for all items | None |
unit | EUMUnit | None | Same unit for all items | None |
items | Sequence[ItemInfo] | None | Different types, units for each items | None |
read
=None, time=None, **kwargs) Dfs0.read(items
Read data from a dfs0 file.
Parameters
Name | Type | Description | Default |
---|---|---|---|
items | str | int | Sequence[str | int] | None | Read only selected items, by number (0-based), or by name | None |
time | int | str | slice | None | Read only selected time steps, by default None (=all) | None |
**kwargs | Any | Additional keyword arguments are ignored | {} |
Returns
Name | Type | Description |
---|---|---|
Dataset | A Dataset with data dimensions [t] |
to_dataframe
=False, round_time='ms') Dfs0.to_dataframe(unit_in_name
Read data from the dfs0 file and return a Pandas DataFrame.
Parameters
Name | Type | Description | Default |
---|---|---|---|
unit_in_name | bool | include unit in column name, default False | False |
round_time | str | round time to avoid problem with floating point inaccurcy, set to False to avoid rounding | 'ms' |
Returns
Name | Type | Description |
---|---|---|
pd.DataFrame |