Homework
Exercise 1
- Download this dfs0 file into a new project folder.
- Create an empty Jupyter Notebook and import mikeio.
- Read the dfs0 file into a
Datasetobject. - Convert the
Datasetobject into a PandasDataFrameobject. - Call the
describe()method and review the statistics. - In the same notebook, select a subset of the items.
- Export the subset
DataFrameto csv with Pandas (hint:to_csv())
Exercise 2
- Download this dfs0 file into a new project folder.
- Create an empty Jupyter Notebook and import mikeio.
- Read the dfs0 file into a
Dataset, only including data between “1993-12-02 16:00” and “1993-12-02 20:00”. - Convert the
Datasetobject into a PandasDataFrameobject. - Plot the
DataFrameusing.plot(). - Select the first 3 rows of the
DataFramein two different ways: usingilocand usingloc.
Exercise 3
- Repeat steps 1-2 of the previous exercise.
- Read the dfs0 file into a
Datasetobject, then convert it to aDataFrame. - Resample the half-hourly data to minutely data (i.e. upsample) using time interpolation.
- Resample the half-hourly data to hourly data (i.e downsample) using mean aggregation.
- Try 3-4 again, except choose a different fill/aggregation method. Compare the results.
Exercise 4
- Download this dfs0 file into a new project folder.
- Create an empty Jupyter Notebook and import mikeio.
- Read the dfs0 file into a
Datasetobject, then convert it to aDataFrame. - Compare the observed and model values using a line plot, a scatter plot, and a histogram.
- Save the plots to a
pngfile.
Exercise 5
- Download this csv file into a new project folder.
- Read the csv file into a
DataFrameusing Pandas. - Check for
nanvalues in the rainfall. How many missing values are there? - Fill the missing value(s) using an appropriate imputation method.
Exercise 6
- Continue from where you left off in the previous exercise.
- Create an
ItemInfoobject for the rainfall data. - Create a
Datasetobject from theDataFrame. Ensure its item metadata is correct. - Save the
Datasetobject to a dfs0 file. - Open the dfs0 file in MIKE+. Does it make sense?
Want to check your work?
Download the exercise solutions: