Skip to content

Commit

Permalink
conflated part a graph stuff into formats
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLeoni committed Oct 10, 2019
1 parent c1057ec commit e10903d
Show file tree
Hide file tree
Showing 14 changed files with 3,182 additions and 1,550 deletions.
86 changes: 44 additions & 42 deletions exams/2019-01-23/exam-2019-01-23-solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -412,46 +412,48 @@
{
"data": {
"text/plain": [
"[{'': '1',\n",
" 'agency_id': '12',\n",
" 'arrival_time': '06:25:00',\n",
" 'departure_time': '06:25:00',\n",
" 'direction_id': '0',\n",
" 'route_id': '76',\n",
" 'route_long_name': 'Trento-Sardagna-Candriai-Vaneze-Vason-Viote',\n",
" 'route_short_name': 'B202',\n",
" 'route_type': '3',\n",
" 'service_id': '22018091220190621',\n",
" 'stop_code': '2620',\n",
" 'stop_desc': '',\n",
" 'stop_id': '844',\n",
" 'stop_lat': '46.064848',\n",
" 'stop_lon': '11.09729',\n",
" 'stop_name': 'Sardagna',\n",
" 'stop_sequence': '2',\n",
" 'trip_headsign': 'Trento-Autostaz.',\n",
" 'trip_id': '0002402742018091220190621',\n",
" 'zone_id': '2620.0'},\n",
" {'': '2',\n",
" 'agency_id': '12',\n",
" 'arrival_time': '06:26:00',\n",
" 'departure_time': '06:26:00',\n",
" 'direction_id': '0',\n",
" 'route_id': '76',\n",
" 'route_long_name': 'Trento-Sardagna-Candriai-Vaneze-Vason-Viote',\n",
" 'route_short_name': 'B202',\n",
" 'route_type': '3',\n",
" 'service_id': '22018091220190621',\n",
" 'stop_code': '2620VD',\n",
" 'stop_desc': '',\n",
" 'stop_id': '5203',\n",
" 'stop_lat': '46.069494',\n",
" 'stop_lon': '11.095252',\n",
" 'stop_name': 'Sardagna Civ. 22',\n",
" 'stop_sequence': '3',\n",
" 'trip_headsign': 'Trento-Autostaz.',\n",
" 'trip_id': '0002402742018091220190621',\n",
" 'zone_id': '2620.0'}]"
"[OrderedDict([('', '1'),\n",
" ('route_id', '76'),\n",
" ('agency_id', '12'),\n",
" ('route_short_name', 'B202'),\n",
" ('route_long_name',\n",
" 'Trento-Sardagna-Candriai-Vaneze-Vason-Viote'),\n",
" ('route_type', '3'),\n",
" ('service_id', '22018091220190621'),\n",
" ('trip_id', '0002402742018091220190621'),\n",
" ('trip_headsign', 'Trento-Autostaz.'),\n",
" ('direction_id', '0'),\n",
" ('arrival_time', '06:25:00'),\n",
" ('departure_time', '06:25:00'),\n",
" ('stop_id', '844'),\n",
" ('stop_sequence', '2'),\n",
" ('stop_code', '2620'),\n",
" ('stop_name', 'Sardagna'),\n",
" ('stop_desc', ''),\n",
" ('stop_lat', '46.064848'),\n",
" ('stop_lon', '11.09729'),\n",
" ('zone_id', '2620.0')]),\n",
" OrderedDict([('', '2'),\n",
" ('route_id', '76'),\n",
" ('agency_id', '12'),\n",
" ('route_short_name', 'B202'),\n",
" ('route_long_name',\n",
" 'Trento-Sardagna-Candriai-Vaneze-Vason-Viote'),\n",
" ('route_type', '3'),\n",
" ('service_id', '22018091220190621'),\n",
" ('trip_id', '0002402742018091220190621'),\n",
" ('trip_headsign', 'Trento-Autostaz.'),\n",
" ('direction_id', '0'),\n",
" ('arrival_time', '06:26:00'),\n",
" ('departure_time', '06:26:00'),\n",
" ('stop_id', '5203'),\n",
" ('stop_sequence', '3'),\n",
" ('stop_code', '2620VD'),\n",
" ('stop_name', 'Sardagna Civ. 22'),\n",
" ('stop_desc', ''),\n",
" ('stop_lat', '46.069494'),\n",
" ('stop_lon', '11.095252'),\n",
" ('zone_id', '2620.0')])]"
]
},
"execution_count": 6,
Expand Down Expand Up @@ -837,7 +839,7 @@
"text": [
"...........\n",
"----------------------------------------------------------------------\n",
"Ran 11 tests in 0.011s\n",
"Ran 11 tests in 0.006s\n",
"\n",
"OK\n",
"..........\n",
Expand Down Expand Up @@ -880,7 +882,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
"version": "3.7.3"
},
"toc": {
"base_numbering": 1,
Expand Down
234 changes: 216 additions & 18 deletions exercises/binary-relations/binary-relations-solution.ipynb

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions exercises/formats/formats-solution.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Data formats solutions\n",
"\n",
"## [Download exercises zip](../../_static/formats-exercises.zip)\n",
"\n",
"[Browse files online](https://github.com/DavidLeoni/datasciprolab/tree/master/exercises/formats)\n",
"\n",
"## Introduction\n",
"\n",
"Here we review how to load and write tabular data such as CSV, tree-like data such as JSON files, and how to fetch it from the web with webapis.\n",
"\n",
"[Graph formats](https://datasciprolab.readthedocs.io/en/latest/exercises/graph-formats/graph-formats-solution.html) are treated in a separate notebook.\n",
"\n",
"## WORK IN PROGRESS ..."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# SOLUTION"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": false,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}
3,306 changes: 2,688 additions & 618 deletions exercises/graph-formats/graph-formats-solution.ipynb

Large diffs are not rendered by default.

File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,21 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Matrix as lists of lists solutions\n",
"# Matrices: list of lists solutions\n",
"\n",
"## [Download exercises zip](../../_static/matrix-lists-exercises.zip)\n",
"## [Download exercises zip](../../_static/matrices-lists-exercises.zip)\n",
"\n",
"[Browse files online](https://github.com/DavidLeoni/datasciprolab/tree/master/exercises/matrix-lists)\n",
"\n"
"[Browse files online](https://github.com/DavidLeoni/datasciprolab/tree/master/exercises/matrices-lists)\n",
"\n",
"## Introduction\n",
"\n",
"Python natively does not provide easy and efficient ways to manipulate matrices. To do so, you would need an external library called numpy which will be seen later in the course. For now we will limit ourselves to using matrices as lists of lists because\n",
"\n",
"\n",
"1. lists are pervasive in Python, you will probably encounter matrices expressed as lists of lists anyway\n",
"2. you get an idea of how to construct a nested data structure\n",
"3. we can discuss memory referencies and copies along the way\n",
"4. even if numpy internal representation is different, it prints matrices as they were lists of lists\n"
]
},
{
Expand All @@ -37,13 +46,10 @@
"```\n",
"\n",
"-jupman.py\n",
"-sciprog.py\n",
"-other stuff ...\n",
"-exercises\n",
" |- matrix-lists\n",
" |- matrix-list-exercise.ipynb \n",
" |- matrix-list-solution.ipynb\n",
" |- other stuff ..\n",
"```\n",
"\n",
"<div class=\"alert alert-warning\">\n",
Expand All @@ -52,7 +58,7 @@
"</div>\n",
"\n",
"\n",
"- open Jupyter Notebook from that folder. Two things should open, first a console and then browser. The browser should show a file list: navigate the list and open the notebook `exercises/matrix-lists/matrix-lists-exercise.ipynb`\n",
"- open Jupyter Notebook from that folder. Two things should open, first a console and then browser. The browser should show a file list: navigate the list and open the notebook `exercises/matrices-lists/matrices-lists-exercise.ipynb`\n",
"- Go on reading that notebook, and follow instuctions inside.\n",
"\n",
"\n",
Expand All @@ -71,21 +77,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Introduction\n",
"### Overview\n",
"\n",
"Python natively does not provide easy and efficient ways to manipulate matrices. To do so, you would need an external library called numpy which will be seen later in the course. For now we will limit ourselves to using matrices as lists of lists because\n",
"\n",
"\n",
"1. lists are pervasive in Python, you will probably encounter matrices expressed as lists of lists anyway\n",
"2. you get an idea of how to construct a nested data structure\n",
"3. we can discuss memory referencies and copies along the way\n",
"4. even if numpy internal representation is different, it prints matrices as they were lists of lists\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"So let's see these lists of lists.For example, we can consider the following a matrix with 3 rows and 2 columns, or in short 3x2 matrix:"
]
},
Expand Down Expand Up @@ -422,7 +415,7 @@
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f1f90325828>"
"<IPython.lib.display.IFrame at 0x7f1ae441deb8>"
]
},
"execution_count": 11,
Expand Down Expand Up @@ -485,7 +478,7 @@
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f1f903250f0>"
"<IPython.lib.display.IFrame at 0x7f1ae441d438>"
]
},
"execution_count": 12,
Expand Down Expand Up @@ -879,7 +872,7 @@
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f1f90249668>"
"<IPython.lib.display.IFrame at 0x7f1ae433d630>"
]
},
"execution_count": 21,
Expand Down Expand Up @@ -1710,7 +1703,7 @@
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f1f90249f60>"
"<IPython.lib.display.IFrame at 0x7f1ae42f13c8>"
]
},
"execution_count": 36,
Expand Down Expand Up @@ -1975,7 +1968,7 @@
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f1f901ecac8>"
"<IPython.lib.display.IFrame at 0x7f1ae4344ac8>"
]
},
"execution_count": 41,
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes

0 comments on commit e10903d

Please sign in to comment.