[chore] display clickable URLs in jupyter
parent
3c3adb5f29
commit
2cb544bc8d
|
@ -4,7 +4,9 @@
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "cb48903e-5021-49fe-9688-45cd0bc05d0f",
|
"id": "cb48903e-5021-49fe-9688-45cd0bc05d0f",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"is_executing": true
|
||||||
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from homeharvest import scrape_property\n",
|
"from homeharvest import scrape_property\n",
|
||||||
|
@ -84,10 +86,34 @@
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# check sold properties\n",
|
"# check sold properties\n",
|
||||||
"scrape_property(\n",
|
"properties = scrape_property(\n",
|
||||||
" location=\"90210\",\n",
|
" location=\"90210\",\n",
|
||||||
" listing_type=\"sold\"\n",
|
" listing_type=\"sold\",\n",
|
||||||
")"
|
" past_days=10\n",
|
||||||
|
")\n",
|
||||||
|
"display(properties)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "628c1ce2",
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false,
|
||||||
|
"is_executing": true,
|
||||||
|
"jupyter": {
|
||||||
|
"outputs_hidden": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# display clickable URLs\n",
|
||||||
|
"from IPython.display import display, HTML\n",
|
||||||
|
"properties['property_url'] = '<a href=\"' + properties['property_url'] + '\" target=\"_blank\">' + properties['property_url'] + '</a>'\n",
|
||||||
|
"\n",
|
||||||
|
"html = properties.to_html(escape=False)\n",
|
||||||
|
"truncate_width = f'<style>.dataframe td {{ max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }}</style>{html}'\n",
|
||||||
|
"display(HTML(truncate_width))"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue