Skip to content

Instantly share code, notes, and snippets.

@SimonGoring
Created December 2, 2021 18:22
Show Gist options
  • Save SimonGoring/81577f583b9cda0fbec71e659b6ce417 to your computer and use it in GitHub Desktop.
Save SimonGoring/81577f583b9cda0fbec71e659b6ce417 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "d8eda840",
"metadata": {
"papermill": {},
"tags": [
"parameters"
]
},
"outputs": [],
"source": [
"#github.com/nteract/papermill'parameters'tag used to inject them into template then post a gist runable by colab\n",
"q=None\n",
"q=\"norway\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b4f3d65b",
"metadata": {
"tags": [
"injected-parameters"
]
},
"outputs": [],
"source": [
"# Parameters\n",
"url = None\n",
"ext = None\n",
"urn = None\n",
"q = \"steens\"\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "35729fe7",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"%load_ext rpy2.ipython\n",
"%load_ext google.colab.data_table\n",
"import httpimport\n",
"with httpimport.github_repo('MBcode', 'ec'):\n",
" import ec\n",
"#ec.get_ec() #work from scratch version for a bit\n",
"#import ec\n",
"df=ec.txt_query(q)\n",
"df"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "3b19b9bf",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"#1st-cut:will have to cut&paste into vars, from Row of interest:\n",
"urn=None\n",
"dfR=ec.wget_rdf(urn)\n",
"#!ls -l or FilePaneBrowser on left, to see it\n",
"url,ext=None,None\n",
"#dfR=ec.read_file(url,ext)\n",
"dfR"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "7540f63c",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"!ls -l \n",
"ec.viz() #shows .nt metadata from urn, can use for (rdf)xml as well "
]
}
],
"metadata": {
"celltoolbar": "Tags",
"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.8.10"
},
"papermill": {
"default_parameters": {},
"environment_variables": {},
"input_path": "/app/templates/sparql.ipynb",
"output_path": "/tmp/q_steens.ipynb",
"parameters": {
"ext": null,
"q": "steens",
"url": null,
"urn": null
},
"version": "2.3.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment