from_pandas(df, items=None)
Create a Dataset from a pandas DataFrame.
Parameters
df |
pd.DataFrame |
DataFrame with time index |
required |
items |
Mapping[str, ItemInfo] | Sequence[ItemInfo] | ItemInfo | None |
Mapping of item names to ItemInfo objects, or a sequence of ItemInfo objects, or a single ItemInfo object. |
None |
Returns
|
Dataset |
time series dataset |
Examples
import pandas as pd
import mikeio
df = pd.DataFrame(
{
"A": [1, 2, 3],
"B": [4, 5, 6],
},
index=pd.date_range("20210101", periods=3, freq="D"),
)
ds = mikeio.from_pandas(df, items={"A": mikeio.ItemInfo(mikeio.EUMType.Water_Level),
"B": mikeio.ItemInfo(mikeio.EUMType.Discharge)})
ds
<mikeio.Dataset>
dims: (time:3)
time: 2021-01-01 00:00:00 - 2021-01-03 00:00:00 (3 records)
geometry: GeometryUndefined()
items:
0: A <Water Level> (meter)
1: B <Discharge> (meter pow 3 per sec)