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

Inline exercises for notebooks 1, 2, 3, and 4 #15

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

darribas
Copy link
Collaborator

@darribas darribas commented Jul 9, 2018

Work in progress but opening for pulling in.

@jorisvandenbossche
Copy link
Member

@darribas sorry, didn't have time to look at this again. Do we still include it in the material for tomorrow?

"source": [
"---\n",
"\n",
"**Exercise**: Which rivers pass within 1 degree of Paris? And for Hong Kong?\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would maybe do it in meters (that's often problem that you need to convert the crs for that)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried first but I ran into issues trying to get a world CRS in metres that worked and the rivers layer was acting up so, for the sake of the example, I left it on degrees.

"source": [
"1. Obtaining a list of European cities\n",
"1. Creating a `GeoDataFrame` with all river lines\n",
"1. For every European city, checking whether at least one river \"crosses\" the area within 1 degree\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this an exercise for notebook 2 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A list of European cities requires a spatial join. It's a compound exercise.

" rivers_crossing = river_lines.crosses(buf).sum()\n",
" if rivers_crossing > 0:\n",
" answer.append(city)\n",
"answer = geopandas.GeoDataFrame(answer, \n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would personally do it with a function and apply. It is maybe more complex in the end, but a good pattern to show IMO.
Or first with loop, and then as exercise to convert it to apply

@darribas
Copy link
Collaborator Author

I'd merge and use if time allows

@darribas
Copy link
Collaborator Author

Just so people can access them, can we merge this so the exercises don't get lost on my fork?

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

Successfully merging this pull request may close these issues.

None yet

2 participants