Skip to content

Commit 71de9d1

Browse files
Detriplicate code block
1 parent f11c68c commit 71de9d1

1 file changed

Lines changed: 8 additions & 32 deletions

File tree

_episodes/08-putting-it-all-together.md

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -273,49 +273,25 @@ plt.show() # not necessary in Jupyter Notebooks
273273
> > ## Answers
274274
> >
275275
> > ~~~
276+
> > import pandas as pd
277+
> > import matplotlib.pyplot as plt
278+
> >
276279
> > discharge = pd.read_csv("data/bouldercreek_09_2013.txt",
277280
> > skiprows=27, delimiter="\t",
278281
> > names=["agency", "site_id", "datetime",
279-
> > "timezone", "discharge", "discharge_cd"])
282+
> > "timezone", "flow_rate", "discharge_cd"])
280283
> > discharge["datetime"] = pd.to_datetime(discharge["datetime"])
281-
> > front_range = discharge[(discharge["datetime"] >= "2013-09-11") &
282-
> > (discharge["datetime"] <= "2013-09-15")]
283-
> >
284-
> > fig, ax = plt.subplots()
285-
> > front_range.plot(x ="datetime", y="discharge", ax=ax)
286-
> > ax.set_xlabel("") # no label
287-
> > ax.set_ylabel("Discharge, cubic feet per second")
288-
> > ax.set_title("Front Range flood event 2013")
289-
> > discharge = pd.read_csv("data/bouldercreek_09_2013.txt",
290-
> > skiprows=27, delimiter="\t",
291-
> > names=["agency", "site_id", "datetime",
292-
> > "timezone", "flow_rate", "height"])
293-
> > fig, ax = plt.subplots()
294284
> > flood = discharge[(discharge["datetime"] >= "2013-09-11") &
295285
> > (discharge["datetime"] <= "2013-09-15")]
296286
> >
297-
> > ax2 = fig.add_axes([0.65, 0.575, 0.25, 0.3])
298-
> > flood.plot(x ="datetime", y="flow_rate", ax=ax)
299-
> > discharge.plot(x ="datetime", y="flow_rate", ax=ax2)
300-
> > ax2.legend().set_visible(False)
301-
> > ax.set_xlabel("") # no label
302-
> > ax.set_ylabel("Discharge, cubic feet per second")
303-
> > ax.legend().set_visible(False)
304-
> > ax.set_title("Front Range flood event 2013")
305-
> > discharge = pd.read_csv("data/bouldercreek_09_2013.txt",
306-
> > skiprows=27, delimiter="\t",
307-
> > names=["agency", "site_id", "datetime",
308-
> > "timezone", "flow_rate", "height"])
309287
> > fig, ax = plt.subplots()
310-
> > flood = discharge[(discharge["datetime"] >= "2013-09-11") &
311-
> > (discharge["datetime"] <= "2013-09-15")]
312-
> >
313288
> > ax2 = fig.add_axes([0.65, 0.575, 0.25, 0.3])
314-
> > flood.plot(x ="datetime", y="flow_rate", ax=ax)
315-
> > discharge.plot(x ="datetime", y="flow_rate", ax=ax2)
289+
> >
290+
> > flood.plot(x="datetime", y="flow_rate", ax=ax)
291+
> > discharge.plot(x="datetime", y="flow_rate", ax=ax2)
316292
> > ax2.legend().set_visible(False)
317293
> >
318-
> > ax.set_xlabel("") # no label
294+
> > ax.set_xlabel("") # no label
319295
> > ax.set_ylabel("Discharge, cubic feet per second")
320296
> > ax.legend().set_visible(False)
321297
> > ax.set_title("Front Range flood event 2013")

0 commit comments

Comments
 (0)