Skip to content

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

Open
darribas wants to merge 5 commits into
geopandas:masterfrom
darribas:master
Open

Inline exercises for notebooks 1, 2, 3, and 4#15
darribas wants to merge 5 commits into
geopandas:masterfrom
darribas:master

Conversation

@darribas

@darribas darribas commented Jul 9, 2018

Copy link
Copy Markdown
Collaborator

Work in progress but opening for pulling in.

@jorisvandenbossche

Copy link
Copy Markdown
Member

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

Comment thread 03-spatial-joins.ipynb
"source": [
"---\n",
"\n",
"**Exercise**: Which rivers pass within 1 degree of Paris? And for Hong Kong?\n",

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread 03-spatial-joins.ipynb
"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
Copy Markdown
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
Copy Markdown
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.

Comment thread 03-spatial-joins.ipynb
" rivers_crossing = river_lines.crosses(buf).sum()\n",
" if rivers_crossing > 0:\n",
" answer.append(city)\n",
"answer = geopandas.GeoDataFrame(answer, \n",

Copy link
Copy Markdown
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
Copy Markdown
Collaborator Author

I'd merge and use if time allows

@darribas

Copy link
Copy Markdown
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.

2 participants