Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Student Notebook issues #38

Closed
1 of 5 tasks
lwasser opened this issue Dec 16, 2018 · 0 comments
Closed
1 of 5 tasks

Student Notebook issues #38

lwasser opened this issue Dec 16, 2018 · 0 comments

Comments

@lwasser
Copy link

lwasser commented Dec 16, 2018

The code below provides a solution for a student plot. At the bottom it has this

### DO NOT REMOVE LINE BELOW ###
ax1 = nb.convert_axes(plt)

I believe that we need to grab the axis object and not call plt.show() but i'm not 100% sure. I am curious why that code disappeared for the first PLOT assignment cell of homework 5 but not for the second.

# For PLOT 1&2: use the data/colorado-flood/precipitation/805325-precip-dailysum-2003-2013.csv file

# PLOT 1: a plot of precipitation from 2003 to 2013
# DO NOT USE plt.show() anywhere in this cell

# BEGIN SOLUTION

f = "data/colorado-flood/discharge/06730200-discharge-daily-1986-2013.txt"
discharge = pd.read_csv(f,
                        skiprows=23,
                        header=[1, 2],
                        sep='\t',
                        parse_dates=[2])
discharge.columns = discharge.columns.droplevel(1)
discharge = discharge.set_index(["datetime"])

monthly_max_all = discharge.resample("M").max()
monthly_max = monthly_max_all['1990':'2014']

# Create scatter plot
fig, ax = plt.subplots(figsize=(10, 8))
ax.scatter(x=monthly_max.index,
           y=monthly_max["17663_00060_00003"],
           color="purple")
ax.set(xlabel='Date', ylabel='Daily Precipitation (inches)',
       title='Homework plot 1: Precipitation-Boulder, CO\n 2013-2014')

# END SOLUTION

### DO NOT REMOVE LINE BELOW ###
ax1 = nb.convert_axes(plt)
  • Can you show me how to customize what a student sees? This cell is visually confusing to a student. i wasn't sure where to add my homework code. I am curious. is there a way to embed running python code in the metadata of a notebook or something? If not, can we add some comments to these cells and then add more spaces to the cells where we want students to add their homework? I'd suggest a blank cell or two above the cell where the answer should be and then the answer cell. it seems to remove all additional spaces.

screen shot 2018-12-15 at 5 52 47 pm

  • When i run the cell with check("time-series-homework-wk-5/q-a34ccf2.py") it doesn't know how to find that function. Where is that function and are there standard imports that belong at the top of all notebooks?

  • here is the cell for plot 2. it seems to retain that call to grab the plot.

screen shot 2018-12-15 at 5 56 36 pm

  • Can we customize the comment on cells where the solutions are hidden

screen shot 2018-12-17 at 3 35 27 pm

I found the code in nbclean but am unsure if there is the ability to parse each cell. The alternative would be to allow for one comment to persist at the top of the cell.

  • Is there any way to maintain code in a cell - for instance like below grabbing the plot element. i think we need to do that as plt.show could break things. i'm not sure however.

screen shot 2018-12-17 at 4 01 06 pm

Update: USER ERROR - I fixed this by using `###` rather than a single `#`
@lwasser lwasser closed this as completed Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant