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

Improves MD to JSON algorithm ( solves #23 ) #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 34 additions & 52 deletions Session_3/Python_Exercises-Copy1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -69,7 +69,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -103,13 +103,13 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"f = open(\"students.md\", \"rt\")\n",
"txt = f.read()\n",
"f.close()\n"
"f.close()"
]
},
{
Expand All @@ -123,7 +123,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -133,7 +133,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -142,7 +142,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand All @@ -151,7 +151,7 @@
"''"
]
},
"execution_count": 19,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -162,14 +162,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -190,7 +183,7 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -199,7 +192,7 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -209,7 +202,7 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": 10,
"metadata": {},
"outputs": [
{
Expand All @@ -218,7 +211,7 @@
"{'a': 'b', 'b': 'c'}"
]
},
"execution_count": 36,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -229,7 +222,7 @@
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -378,14 +371,17 @@
" if not line.strip()==\"\":\n",
" print(f'process \"{line}\"')\n",
" lhs, rhs = (line[2:].split(\":\"))\n",
" lhs = lhs.strip()\n",
" rhs = rhs.strip()\n",
" record[lhs] = rhs"
" lhs = lhs.strip()\n",
" if rhs != \"\":\n",
" record[lhs] = rhs\n",
" else:\n",
" record[lhs] = None"
]
},
{
"cell_type": "code",
"execution_count": 39,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand All @@ -396,7 +392,7 @@
" 'last name': 'Dekel',\n",
" 'first name': 'Amit',\n",
" 'operating system': 'Windows 10',\n",
" 'memory': '',\n",
" 'memory': None,\n",
" 'research interest': 'Social networks',\n",
" 'expectations': 'write code more efficiently'},\n",
" {'identifier': 'Jaimito30',\n",
Expand All @@ -406,7 +402,7 @@
" 'operating system': 'mac os mojave',\n",
" 'memory': '8GB',\n",
" 'research interest': 'Macro-finance, dynamic programming',\n",
" 'expectations': ''},\n",
" 'expectations': None},\n",
" {'identifier': 'paolosantini',\n",
" 'email': '[email protected]',\n",
" 'last name': 'Santini',\n",
Expand Down Expand Up @@ -447,7 +443,7 @@
" 'memory': '8go',\n",
" 'research interest': 'topic modelling, text analysis, network analysis, quantitative history of economics',\n",
" 'expectations': 'get insights on text analysis in python'},\n",
" {'identifier': '',\n",
" {'identifier': None,\n",
" 'email': '[email protected]',\n",
" 'last name': 'Ozguzel',\n",
" 'first name': 'Cem',\n",
Expand Down Expand Up @@ -497,7 +493,7 @@
" 'expectations': 'network analysis and learn a bit about scrapping'}]"
]
},
"execution_count": 39,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -508,7 +504,7 @@
},
{
"cell_type": "code",
"execution_count": 40,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -517,7 +513,7 @@
},
{
"cell_type": "code",
"execution_count": 47,
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -526,7 +522,7 @@
},
{
"cell_type": "code",
"execution_count": 45,
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -535,7 +531,7 @@
},
{
"cell_type": "code",
"execution_count": 46,
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -545,14 +541,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 49,
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -562,7 +551,7 @@
},
{
"cell_type": "code",
"execution_count": 51,
"execution_count": 19,
"metadata": {},
"outputs": [
{
Expand All @@ -575,15 +564,15 @@
" 'yaz26',\n",
" 'eniloracyloc',\n",
" 'gnoblet',\n",
" '',\n",
" None,\n",
" 'DavidRhysBernard',\n",
" 'thomasszuber',\n",
" 'SuperMayo',\n",
" 'mfranc01',\n",
" 'SimonBunel']"
]
},
"execution_count": 51,
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -594,21 +583,14 @@
},
{
"cell_type": "code",
"execution_count": 53,
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"import yaml\n",
"with open(\"students.yaml\", 'wt') as f:\n",
" yaml.dump(observations, f)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -627,7 +609,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.1"
"version": "3.7.2"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion Students/students.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"identifier": "amitdekel", "email": "[email protected]", "last name": "Dekel", "first name": "Amit", "operating system": "Windows 10", "memory": "", "research interest": "Social networks", "expectations": "write code more efficiently"}, {"identifier": "Jaimito30", "email": "[email protected]", "last name": "Leyva", "first name": "Jaime", "operating system": "mac os mojave", "memory": "8GB", "research interest": "Macro-finance, dynamic programming", "expectations": ""}, {"identifier": "paolosantini", "email": "[email protected]", "last name": "Santini", "first name": "Paolo", "operating system": "Windows", "memory": "8G (I guess)", "research interest": "Inequality, network, choice of collaboration", "expectations": "I expect to learn how to use python to analyse networks and how to use it for my analysis"}, {"identifier": "MartinJgd", "email": "[email protected]", "last name": "Jegard", "first name": "Martin", "operating system": "Windows 10", "memory": "8 Go", "research interest": "trade & environmental economics", "expectations": "learn to use new programming tools and improve my coding efficiency"}, {"identifier": "yaz26", "email": "[email protected]", "last name": "Govind", "first name": "Yajna", "operating system": "macOS X El Capitan", "memory": "4 GB 1600Mhz", "research interest": "Inequality and Income Distribution", "expectations": "Learning webscrapping and text analysis"}, {"identifier": "eniloracyloc", "email": "[email protected]", "last name": "Coly", "first name": "Caroline", "operating system": "N/A", "memory": "N/A", "research interest": "Labour economics", "expectations": "scrap text and analyse it"}, {"identifier": "gnoblet", "email": "[email protected]", "last name": "noblet", "first name": "guillaume", "operating system": "manjaro", "memory": "8go", "research interest": "topic modelling, text analysis, network analysis, quantitative history of economics", "expectations": "get insights on text analysis in python"}, {"identifier": "", "email": "[email protected]", "last name": "Ozguzel", "first name": "Cem", "operating system": "IOS", "memory": "8 GB", "research interest": "International Migration, Labor", "expectations": "Get familiar with all of these tools (e.g. Python, Julia etc.), learn more about webscrapping for collecting data."}, {"identifier": "DavidRhysBernard", "email": "[email protected]", "last name": "Bernard", "first name": "David", "operating system": "Windows 10", "memory": "4gb", "research interest": "Microeconometrics, causal inference, development", "expectations": "More efficient coding, reproducible research"}, {"identifier": "thomasszuber", "email": "[email protected]", "last name": "Zuber", "first name": "Thomas", "operating system": "OSX", "memory": "4 GB", "research interest": "Structural change, labor reallocation, firm dynamics", "expectations": "git/python fluency"}, {"identifier": "SuperMayo", "email": "[email protected]", "last name": "Mayerowitz", "first name": "Antoine", "operating system": "MacOs Mojave", "memory": "8", "research interest": "TBD", "expectations": "Conquer the world"}, {"identifier": "mfranc01", "email": "[email protected]", "last name": "FRANCOIS", "first name": "Manon", "operating system": "OSX", "memory": "4 Go 1600 MHz DDR3", "research interest": "International Corporate Taxation", "expectations": "increase coding efficiency and learn new techniques"}, {"identifier": "SimonBunel", "email": "[email protected]", "last name": "Bunel", "first name": "Simon", "operating system": "macOS X El Capitan", "memory": "4 GB", "research interest": "Innovation, patents, etc.", "expectations": "network analysis and learn a bit about scrapping"}]
[{"identifier": "amitdekel", "email": "[email protected]", "last name": "Dekel", "first name": "Amit", "operating system": "Windows 10", "memory": null, "research interest": "Social networks", "expectations": "write code more efficiently"}, {"identifier": "Jaimito30", "email": "[email protected]", "last name": "Leyva", "first name": "Jaime", "operating system": "mac os mojave", "memory": "8GB", "research interest": "Macro-finance, dynamic programming", "expectations": null}, {"identifier": "paolosantini", "email": "[email protected]", "last name": "Santini", "first name": "Paolo", "operating system": "Windows", "memory": "8G (I guess)", "research interest": "Inequality, network, choice of collaboration", "expectations": "I expect to learn how to use python to analyse networks and how to use it for my analysis"}, {"identifier": "MartinJgd", "email": "[email protected]", "last name": "Jegard", "first name": "Martin", "operating system": "Windows 10", "memory": "8 Go", "research interest": "trade & environmental economics", "expectations": "learn to use new programming tools and improve my coding efficiency"}, {"identifier": "yaz26", "email": "[email protected]", "last name": "Govind", "first name": "Yajna", "operating system": "macOS X El Capitan", "memory": "4 GB 1600Mhz", "research interest": "Inequality and Income Distribution", "expectations": "Learning webscrapping and text analysis"}, {"identifier": "eniloracyloc", "email": "[email protected]", "last name": "Coly", "first name": "Caroline", "operating system": "N/A", "memory": "N/A", "research interest": "Labour economics", "expectations": "scrap text and analyse it"}, {"identifier": "gnoblet", "email": "[email protected]", "last name": "noblet", "first name": "guillaume", "operating system": "manjaro", "memory": "8go", "research interest": "topic modelling, text analysis, network analysis, quantitative history of economics", "expectations": "get insights on text analysis in python"}, {"identifier": null, "email": "[email protected]", "last name": "Ozguzel", "first name": "Cem", "operating system": "IOS", "memory": "8 GB", "research interest": "International Migration, Labor", "expectations": "Get familiar with all of these tools (e.g. Python, Julia etc.), learn more about webscrapping for collecting data."}, {"identifier": "DavidRhysBernard", "email": "[email protected]", "last name": "Bernard", "first name": "David", "operating system": "Windows 10", "memory": "4gb", "research interest": "Microeconometrics, causal inference, development", "expectations": "More efficient coding, reproducible research"}, {"identifier": "thomasszuber", "email": "[email protected]", "last name": "Zuber", "first name": "Thomas", "operating system": "OSX", "memory": "4 GB", "research interest": "Structural change, labor reallocation, firm dynamics", "expectations": "git/python fluency"}, {"identifier": "SuperMayo", "email": "[email protected]", "last name": "Mayerowitz", "first name": "Antoine", "operating system": "MacOs Mojave", "memory": "8", "research interest": "TBD", "expectations": "Conquer the world"}, {"identifier": "mfranc01", "email": "[email protected]", "last name": "FRANCOIS", "first name": "Manon", "operating system": "OSX", "memory": "4 Go 1600 MHz DDR3", "research interest": "International Corporate Taxation", "expectations": "increase coding efficiency and learn new techniques"}, {"identifier": "SimonBunel", "email": "[email protected]", "last name": "Bunel", "first name": "Simon", "operating system": "macOS X El Capitan", "memory": "4 GB", "research interest": "Innovation, patents, etc.", "expectations": "network analysis and learn a bit about scrapping"}]
8 changes: 4 additions & 4 deletions Students/students.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- {email: [email protected], expectations: write code more efficiently, first name: Amit,
identifier: amitdekel, last name: Dekel, memory: '', operating system: Windows 10,
research interest: Social networks}
- {email: [email protected], expectations: '', first name: Jaime, identifier: Jaimito30,
identifier: amitdekel, last name: Dekel, memory: null, operating system: Windows
10, research interest: Social networks}
- {email: [email protected], expectations: null, first name: Jaime, identifier: Jaimito30,
last name: Leyva, memory: 8GB, operating system: mac os mojave, research interest: 'Macro-finance,
dynamic programming'}
- {email: [email protected], expectations: I expect to learn how to use python
Expand All @@ -24,7 +24,7 @@
analysis, quantitative history of economics'}
- {email: [email protected], expectations: 'Get familiar with all of these tools
(e.g. Python, Julia etc.), learn more about webscrapping for collecting data.',
first name: Cem, identifier: '', last name: Ozguzel, memory: 8 GB, operating system: IOS,
first name: Cem, identifier: null, last name: Ozguzel, memory: 8 GB, operating system: IOS,
research interest: 'International Migration, Labor'}
- {email: [email protected], expectations: 'More efficient coding, reproducible
research', first name: David, identifier: DavidRhysBernard, last name: Bernard,
Expand Down