Skip to content

Instantly share code, notes, and snippets.

@steelp2002
Created May 10, 2018 03:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steelp2002/c8f65822fc9b416f23dfe551b90f4499 to your computer and use it in GitHub Desktop.
Save steelp2002/c8f65822fc9b416f23dfe551b90f4499 to your computer and use it in GitHub Desktop.
python for bigdata
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"def makeHomePage(name, interest):\n",
" file=open(\"homepage.html\",\"wt\")\n",
" file.write(\"\"\"<!DOCTYPE html>\n",
" <html>\n",
" <head>\n",
" <title>\"\"\"+name+\"\"\"'s Home Page</title>\n",
" </head>\n",
" <body>\n",
" <h1>Welcome to \"\"\"+name+\"\"\"'s Home Page</h1>\n",
" <p>Hi! I am \"\"\"+name+\"\"\". This is My home page!\n",
" I am interested in \"\"\"+interest+\"\"\"</p>\n",
" </body>\n",
" </html>\"\"\")\n",
" file.close()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"makeHomePage(\"SunHyo\", \"Coding\")"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import webbrowser\n",
"webbrowser.open(\"homepage.html\")"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [],
"source": [
"def makeHomePage(name, interest):\n",
" file=open(\"homepage.html\",\"wt\")\n",
" file.write(doctype())\n",
" file.write(title(name+\"'s Home Page\"))\n",
" file.write(body(\"\"\"\n",
" <h1>Welcome to \"\"\"+name+\"\"\"'s Home Page</h1>\n",
" <p>Hi! I am \"\"\"+name+\"\"\". This is My home page!\n",
" I am interested in \"\"\"+interest+\"\"\"</p>\"\"\"))\n",
" file.close()\n",
"\n",
"def doctype():\n",
" return '<!DOCTYPE html>'\n",
"\n",
"def title(titlestring):\n",
" return \"<html><head><title>\"+titlestring+\"</title></head>\"\\\n",
"\n",
"def body(bodystring):\n",
" return \"<body>\"+bodystring+\"</body></html>\""
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [],
"source": [
"makeHomePage(\"SunHyo\", \"Coding\")"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import webbrowser\n",
"webbrowser.open(\"homepage.html\")"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"def makeSamplePage(directory):\n",
" samplesFile=open(directory+\"/samples.html\",\"wt\")\n",
" samplesFile.write(doctype())\n",
" samplesFile.write(title(\"Samples from \"+directory))\n",
" samples=\"<h1>Samples from \"+directory+\"</h1>\"\n",
" for file in os.listdir(directory):\n",
" if file.endswith(\".jpg\"):\n",
" samples=samples+\"<p>Filename: \"+file\n",
" samples=samples+'<image src=\"'+file+'\"height=\"100\"></p>'\n",
" samplesFile.write(body(samples))\n",
" samplesFile.close()"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {},
"outputs": [],
"source": [
"makeSamplePage(\".\")"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import webbrowser\n",
"webbrowser.open(\"samples.html\")"
]
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {},
"outputs": [],
"source": [
"import xml.etree.ElementTree as ET"
]
},
{
"cell_type": "code",
"execution_count": 66,
"metadata": {},
"outputs": [],
"source": [
"doc = ET.parse('country.xml')"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [],
"source": [
"root=doc.getroot()"
]
},
{
"cell_type": "code",
"execution_count": 76,
"metadata": {},
"outputs": [],
"source": [
"country_tag = root.find(\"country\")"
]
},
{
"cell_type": "code",
"execution_count": 77,
"metadata": {},
"outputs": [],
"source": [
"country_tags = root.findall(\"country\")"
]
},
{
"cell_type": "code",
"execution_count": 78,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'\\n '"
]
},
"execution_count": 78,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"country_text = root.findtext(\"country\")\n",
"country_text"
]
},
{
"cell_type": "code",
"execution_count": 79,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'\\n '"
]
},
"execution_count": 79,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"country_text = root.find(\"country\").text\n",
"country_text"
]
},
{
"cell_type": "code",
"execution_count": 80,
"metadata": {},
"outputs": [],
"source": [
"year_tags=root.findall(\"year\")"
]
},
{
"cell_type": "code",
"execution_count": 82,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<Element 'country' at 0x042D46F0>,\n",
" <Element 'country' at 0x042D4750>,\n",
" <Element 'country' at 0x042D4840>]"
]
},
"execution_count": 82,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"country_tags"
]
},
{
"cell_type": "code",
"execution_count": 83,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 83,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"year_tags"
]
},
{
"cell_type": "code",
"execution_count": 84,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"data\n",
"country\n",
"rank\n",
"year\n",
"gdppc\n",
"neighbor\n",
"neighbor\n",
"country\n",
"rank\n",
"year\n",
"gdppc\n",
"neighbor\n",
"country\n",
"rank\n",
"year\n",
"gdppc\n",
"neighbor\n",
"neighbor\n"
]
}
],
"source": [
"for child in root.iter():\n",
" print(child.tag)"
]
},
{
"cell_type": "code",
"execution_count": 90,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'name': 'Liechtenstein'}\n",
"{'name': 'Singapore'}\n",
"{'name': 'Panama'}\n"
]
}
],
"source": [
"for country in root.iter(\"country\"):\n",
" print(country.attrib)"
]
},
{
"cell_type": "code",
"execution_count": 89,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"============================================================\n",
"Country : Liechtenstein\n",
"Rank : 2\n",
"Year : 2008\n",
"Neighbor : {'name': 'Austria', 'direction': 'E'}\n",
"Neighbor : {'name': 'Switzerland', 'direction': 'W'}\n",
"============================================================\n",
"Country : Singapore\n",
"Rank : 5\n",
"Year : 2011\n",
"Neighbor : {'name': 'Malaysia', 'direction': 'N'}\n",
"============================================================\n",
"Country : Panama\n",
"Rank : 69\n",
"Year : 2011\n",
"Neighbor : {'name': 'Costa Rica', 'direction': 'W'}\n",
"Neighbor : {'name': 'Colombia', 'direction': 'E'}\n"
]
}
],
"source": [
"for country in root.iter(\"country\"):\n",
" print(\"=\"*60)\n",
" print(\"Country :\", country.attrib[\"name\"])\n",
" print(\"Rank :\", country.findtext(\"rank\"))\n",
" print(\"Year :\", country.findtext(\"year\"))\n",
" for neighbor in country.iter(\"neighbor\"):\n",
" print(\"Neighbor :\", neighbor.attrib)"
]
},
{
"cell_type": "code",
"execution_count": 91,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<data>\n",
" <country name=\"Liechtenstein\">\n",
" <rank updated=\"yes\" updated again=\"yes\">3</rank>\n",
" <year>2008</year>\n",
" <gdppc>141100</gdppc>\n",
" <neighbor direction=\"E\" name=\"Austria\" />\n",
" <neighbor direction=\"W\" name=\"Switzerland\" />\n",
" </country>\n",
" <country name=\"Singapore\">\n",
" <rank updated=\"yes\" updated again=\"yes\">6</rank>\n",
" <year>2011</year>\n",
" <gdppc>59900</gdppc>\n",
" <neighbor direction=\"N\" name=\"Malaysia\" />\n",
" </country>\n",
" <country name=\"Panama\">\n",
" <rank updated=\"yes\" updated again=\"yes\">70</rank>\n",
" <year>2011</year>\n",
" <gdppc>13600</gdppc>\n",
" <neighbor direction=\"W\" name=\"Costa Rica\" />\n",
" <neighbor direction=\"E\" name=\"Colombia\" />\n",
" </country>\n",
"</data>\n"
]
}
],
"source": [
"for rank in root.iter(\"rank\"):\n",
" new_rank = int(rank.text)+1\n",
" rank.text = str(new_rank)\n",
" rank.attrib[\"updated again\"] = \"yes\"\n",
"ET.dump(root) "
]
},
{
"cell_type": "code",
"execution_count": 92,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<data>\n",
" <country name=\"Liechtenstein\">\n",
" <rank updated=\"yes\" updated again=\"yes\">3</rank>\n",
" <year>2008</year>\n",
" <gdppc>141100</gdppc>\n",
" <neighbor direction=\"E\" name=\"Austria\" />\n",
" <neighbor direction=\"W\" name=\"Switzerland\" />\n",
" </country>\n",
" <country name=\"Singapore\">\n",
" <rank updated=\"yes\" updated again=\"yes\">6</rank>\n",
" <year>2011</year>\n",
" <gdppc>59900</gdppc>\n",
" <neighbor direction=\"N\" name=\"Malaysia\" />\n",
" </country>\n",
" </data>\n"
]
}
],
"source": [
"for country in root.iter(\"country\"):\n",
" rank = int(country.find('rank').text)\n",
" if rank>50:\n",
" root.remove(country) \n",
"ET.dump(root) "
]
},
{
"cell_type": "code",
"execution_count": 96,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<data>\n",
" <country name=\"Liechtenstein\">\n",
" <rank updated=\"yes\" updated again=\"yes\">3</rank>\n",
" <year>2008</year>\n",
" <gdppc>141100</gdppc>\n",
" <neighbor direction=\"E\" name=\"Austria\" />\n",
" <neighbor direction=\"W\" name=\"Switzerland\" />\n",
" <last_updated>2018-05-08 12:39:17.470866</last_updated></country>\n",
" <country name=\"Singapore\">\n",
" <rank updated=\"yes\" updated again=\"yes\">6</rank>\n",
" <year>2011</year>\n",
" <gdppc>59900</gdppc>\n",
" <neighbor direction=\"N\" name=\"Malaysia\" />\n",
" <last_updated>2018-05-08 12:39:17.470866</last_updated></country>\n",
" </data>\n"
]
}
],
"source": [
"import datetime\n",
"for country in root.iter(\"country\"):\n",
" e=datetime.datetime.now()\n",
" last_updated=ET.Element(\"last_updated\")\n",
" last_updated.text = str(e)\n",
" country.append(last_updated) \n",
"ET.dump(root) "
]
},
{
"cell_type": "code",
"execution_count": 98,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<data>\n",
" <country name=\"Liechtenstein\">\n",
" <rank updated=\"yes\" updated again=\"yes\">3</rank>\n",
" <year>2008</year>\n",
" <gdppc>141100</gdppc>\n",
" <neighbor direction=\"E\" name=\"Austria\" />\n",
" <neighbor direction=\"W\" name=\"Switzerland\" />\n",
" <last_updated>2018-05-08 12:39:17.470866</last_updated>\n",
" </country>\n",
" <country name=\"Singapore\">\n",
" <rank updated=\"yes\" updated again=\"yes\">6</rank>\n",
" <year>2011</year>\n",
" <gdppc>59900</gdppc>\n",
" <neighbor direction=\"N\" name=\"Malaysia\" />\n",
" <last_updated>2018-05-08 12:39:17.470866</last_updated>\n",
" </country>\n",
"</data>\n"
]
}
],
"source": [
"def auto_indent(elem, level = 0):\n",
" indent = \"\\n\" + level*\" \"\n",
" if len(elem):\n",
" if not elem.text or not elem.text.strip():\n",
" elem.text = indent+\" \"\n",
" if not elem.tail or not elem.tail.strip():\n",
" elem.tail = indent\n",
" for elem in elem:\n",
" auto_indent(elem, level+1)\n",
" if not elem.tail or not elem.tail.strip():\n",
" elem.tail = indent\n",
" else:\n",
" if level and (not elem.tail or not elem.tail.strip()):\n",
" elem.tail = indent\n",
"\n",
"auto_indent(root)\n",
"ET.dump(root)\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 102,
"metadata": {},
"outputs": [],
"source": [
"doc.write(\"new.xml\", encoding=\"utf-8\", xml_declaration=True)"
]
},
{
"cell_type": "code",
"execution_count": 117,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Unable to connect\n"
]
}
],
"source": [
"import urllib\n",
"try:\n",
" response = urllib.request('https://www.packtpub.com/rss.xml')\n",
" xml = response.read()\n",
" print(xml)\n",
" \n",
" response.close()\n",
"\n",
"except:\n",
" print('Unable to connect')"
]
},
{
"cell_type": "code",
"execution_count": 118,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"b'<?xml version=\"1.0\" encoding=\"utf-8\"?>\\n<rss version=\"2.0\" xml:base=\"http://www.packtpub.com\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\\n<channel>\\n <title>Packt Publishing</title>\\n <link>http://www.packtpub.com</link>\\n <description>Special eBook Offer:Buy any 2 eBooks and Get 50% off both the eBooks.\\r\\nView Best Selling Bundles.\\r\\n</description>\\n <language>en</language>\\n<item>\\n <title>Implementing 3 Naive Bayes classifiers in scikit-learn : Bernoulli, Multinomial and Gaussian naive Bayes algorithms</title>\\n <link>http://www.packtpub.com/books/content/naive-bayes</link>\\n <description>&lt;p&gt;Scikit-learn provide three naive Bayes implementations: Bernoulli, multinomial and Gaussian. The only difference is about the probability distribution adopted. The first one is a binary algorithm particularly useful when a feature can be present or not. Multinomial naive Bayes assumes to have feature vector where each element represents the number of times it appears (or, very often, its frequency). This technique is very efficient in natural language processing or whenever the samples are composed starting from a common dictionary. The Gaussian Naive Bayes, instead, is based on a continuous distribution and it&#039;s suitable for more generic classification tasks.&lt;/p&gt;\\n&lt;p&gt;Ok, now that we have established naive Bayes variants are a handy set of algorithms to have in our machine learning arsenal and that Scikit-learn is a good tool to implement them, let\\xe2\\x80\\x99s rewind a bit.&lt;/p&gt;\\n&lt;p&gt;&lt;a href=&quot;http://www.packtpub.com/books/content/naive-bayes&quot; target=&quot;_blank&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>\\n <category domain=\"http://www.packtpub.com/category/book-categories/big-data-business-intelligence\">Big Data &amp;amp; Business Intelligence</category>\\n <pubDate>Tue, 13 Mar 2018 15:04:24 +0000</pubDate>\\n <dc:creator>Ronit Pawar</dc:creator>\\n <guid isPermaLink=\"false\">32884 at http://www.packtpub.com</guid>\\n</item>\\n<item>\\n <title>8 built-in Angular Pipes in Angular 4 that you should know</title>\\n <link>http://www.packtpub.com/books/content/8-built-angular-pipes-angular-4-you-should-know</link>\\n <description>&lt;p&gt;Angular is a mature technology with introduction to new way to build applications. Think of Angular Pipes as modernized version of filters comprising functions or helps used to format the values within the template. Pipes in Angular are basically extension of what filters were in Angular v1. There are many useful built-in Pipes we can use easily in our templates. In today\\xe2\\x80\\x99s tutorial we will learn about Built-in Pipes as well as create our own custom user-defined pipe.&lt;/p&gt;\\n&lt;p style=&quot;margin-left: 40px; margin-right: 40px;&quot; align=&quot;center&quot;&gt;&lt;em&gt;(For more resources related to this topic, see &lt;a href=&quot;#more&quot;&gt;here&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;\\n&lt;h2&gt;&lt;strong&gt;Angular Pipes - overview&lt;/strong&gt;&lt;/h2&gt;\\n&lt;p&gt;Pipes allows us to format the values within the view of the templates before it&#039;s displayed. For example, in most modern applications, we want to display terms, such as today, tomorrow, and so on and not system date formats such as April 13 2017 08:00. Let&#039;s look more real-world scenarios.&lt;/p&gt;\\n&lt;p&gt;&lt;a href=&quot;http://www.packtpub.com/books/content/8-built-angular-pipes-angular-4-you-should-know&quot; target=&quot;_blank&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>\\n <category domain=\"http://www.packtpub.com/taxonomy/term/268\">Web Development</category>\\n <pubDate>Tue, 13 Mar 2018 06:22:33 +0000</pubDate>\\n <dc:creator>Michaelh Henriques</dc:creator>\\n <guid isPermaLink=\"false\">32852 at http://www.packtpub.com</guid>\\n</item>\\n<item>\\n <title>Article</title>\\n <link>http://www.packtpub.com/books/content/article-0</link>\\n <description>&lt;p&gt;In this article by &lt;strong&gt;Rahul Mohta&lt;/strong&gt;, Yogesh Kasat, and Jila Jeet Yadav, the authors of &lt;a href=&quot;https://www.packtpub.com/big-data-and-business-intelligence/implementing-microsoft-dynamics-365-operations&quot;&gt;Implementing Microsoft Dynamics 365 for Finance and Operations&lt;/a&gt;, we will discuss organizations&#039; need for a system of records to manage the data, control it, and use it for their growth. This often leads to embracing business applications for managing their resources well and keep improving. This used to traditionally happen in software installed in the customer location; it later evolved to hosting either internally or at the partner&#039;s premise. Now, in this modern world, it has transformed into leveraging the power and elasticity of cloud.&lt;/p&gt;\\n&lt;p&gt;Dynamics 365 is a cloud service from Microsoft, combining several business needs into a single, scalable, and agile platform, allowing organizations to bring in the much needed digital disruption.&lt;/p&gt;\\n&lt;p&gt;&lt;a href=&quot;http://www.packtpub.com/books/content/article-0&quot; target=&quot;_blank&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>\\n <category domain=\"http://www.packtpub.com/category/book-categories/big-data-business-intelligence\">Big Data &amp;amp; Business Intelligence</category>\\n <pubDate>Mon, 05 Mar 2018 10:44:59 +0000</pubDate>\\n <dc:creator>Ronit Pawar</dc:creator>\\n <guid isPermaLink=\"false\">32749 at http://www.packtpub.com</guid>\\n</item>\\n<item>\\n <title>Walkthrough of Storm UI</title>\\n <link>http://www.packtpub.com/books/content/walkthrough-storm-ui</link>\\n <description>&lt;p&gt;In this article by &lt;strong&gt;Ankit Jain&lt;/strong&gt;, the author of the book &lt;a href=&quot;https://www.packtpub.com/big-data-and-business-intelligence/mastering-apache-storm&quot;&gt;Mastering Apache Storm&lt;/a&gt;,This section we will seehow you how we can start the Storm UI daemon. However, before starting the Storm UI daemon, we assume that you have a running Storm cluster.&lt;/p&gt;\\n&lt;p&gt;The Storm cluster deployment steps are mentioned in previous step. NNow, go to the Storm home directory (cd $STORM_HOME) at the Leader Nimbus machine and run the following command to start the Storm UI daemon:&lt;/p&gt;\\n&lt;pre class=&quot;line-numbers&quot;&gt;&lt;code class=&quot;null&quot;&gt;$&amp;gt; cd $STORM_HOME\\t\\n\\n$&amp;gt; bin/storm ui &amp;amp;\\n&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;margin-left: 40px; margin-right: 40px;&quot; align=&quot;center&quot;&gt;&lt;em&gt;(For more resources related to this topic, see &lt;a href=&quot;https://www.packtpub.com/big-data-and-business-intelligence/mastering-apache-storm&quot;&gt;here&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;\\n&lt;p&gt;&lt;a href=&quot;http://www.packtpub.com/books/content/walkthrough-storm-ui&quot; target=&quot;_blank&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>\\n <category domain=\"http://www.packtpub.com/category/book-categories/big-data-business-intelligence\">Big Data &amp;amp; Business Intelligence</category>\\n <pubDate>Sun, 04 Mar 2018 15:36:10 +0000</pubDate>\\n <dc:creator>Ronit Pawar</dc:creator>\\n <guid isPermaLink=\"false\">32733 at http://www.packtpub.com</guid>\\n</item>\\n<item>\\n <title>Walkthrough of Storm UI</title>\\n <link>http://www.packtpub.com/node/32732</link>\\n <description>&lt;p&gt;In this article by &lt;strong&gt;Ankit Jain&lt;/strong&gt;, the author of the book &lt;a href=&quot;https://www.packtpub.com/big-data-and-business-intelligence/mastering-apache-storm&quot;&gt;Mastering Apache Storm&lt;/a&gt;,This section we will seehow you how we can start the Storm UI daemon. However, before starting the Storm UI daemon, we assume that you have a running Storm cluster.&lt;/p&gt;\\n&lt;p&gt;The Storm cluster deployment steps are mentioned in previous step. NNow, go to the Storm home directory (cd $STORM_HOME) at the Leader Nimbus machine and run the following command to start the Storm UI daemon:&lt;/p&gt;\\n&lt;pre class=&quot;line-numbers&quot;&gt;&lt;code class=&quot;null&quot;&gt;$&amp;gt; cd $STORM_HOME\\t\\n\\n$&amp;gt; bin/storm ui &amp;amp;\\n&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;margin-left: 40px; margin-right: 40px;&quot; align=&quot;center&quot;&gt;&lt;em&gt;(For more resources related to this topic, see &lt;a href=&quot;https://www.packtpub.com/big-data-and-business-intelligence/mastering-apache-storm&quot;&gt;here&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;\\n&lt;p&gt;&lt;a href=&quot;http://www.packtpub.com/node/32732&quot; target=&quot;_blank&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>\\n <category domain=\"http://www.packtpub.com/category/book-categories/big-data-business-intelligence\">Big Data &amp;amp; Business Intelligence</category>\\n <pubDate>Sun, 04 Mar 2018 14:47:55 +0000</pubDate>\\n <dc:creator>Ronit Pawar</dc:creator>\\n <guid isPermaLink=\"false\">32732 at http://www.packtpub.com</guid>\\n</item>\\n<item>\\n <title>Article</title>\\n <link>http://www.packtpub.com/books/content/article</link>\\n <description>&lt;p&gt;In this article by &lt;strong&gt;Rahul Mohta, Yogesh Kasat,&lt;/strong&gt; and &lt;strong&gt;Jila Jeet Yadav&lt;/strong&gt;, the authors of &lt;a href=&quot;https://www.packtpub.com/big-data-and-business-intelligence/implementing-microsoft-dynamics-365-operations&quot;&gt;Implementing Microsoft Dynamics 365 for Finance and Operations&lt;/a&gt;, we will discuss organizations&#039; need for a system of records to manage the data, control it, and use it for their growth. This often leads to embracing business applications for managing their resources well and keep improving. This used to traditionally happen in software installed in the customer location; it later evolved to hosting either internally or at the partner&#039;s premise. Now, in this modern world, it has transformed into leveraging the power and elasticity of cloud.&lt;/p&gt;\\n&lt;p&gt;Dynamics 365 is a cloud service from Microsoft, combining several business needs into a single, scalable, and agile platform, allowing organizations to bring in the much needed digital disruption.&lt;/p&gt;\\n&lt;p&gt;&lt;a href=&quot;http://www.packtpub.com/books/content/article&quot; target=&quot;_blank&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>\\n <category domain=\"http://www.packtpub.com/category/book-categories/big-data-business-intelligence\">Big Data &amp;amp; Business Intelligence</category>\\n <pubDate>Sun, 04 Mar 2018 08:36:52 +0000</pubDate>\\n <dc:creator>Ronit Pawar</dc:creator>\\n <guid isPermaLink=\"false\">32731 at http://www.packtpub.com</guid>\\n</item>\\n<item>\\n <title>FastTrack to OOP - Classes and Interfaces</title>\\n <link>http://www.packtpub.com/books/content/fasttrack-oop-classes-and-interfaces</link>\\n <description>&lt;p&gt;In this article by &lt;strong&gt;Mohamed Sanaulla&lt;/strong&gt; and &lt;strong&gt;Nick Samoylov&lt;/strong&gt;, the authors of &lt;a href=&quot;https://www.packtpub.com/application-development/java-9-cookbook&quot;&gt;Java 9 Cookbook&lt;/a&gt;, we will cover the following recipe:&lt;/p&gt;\\n&lt;ul&gt;\\n&lt;li&gt;Implementing object-oriented design using classes&lt;/li&gt;\\n&lt;/ul&gt;\\n&lt;p style=&quot;margin-left: 40px; margin-right: 40px;&quot; align=&quot;center&quot;&gt;&lt;em&gt;(For more resources related to this topic, see &lt;a href=&quot;https://www.packtpub.com/application-development/java-9-cookbook&quot;&gt;here&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;\\n&lt;p&gt;&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;strong&gt;Implementing object-oriented design using classes&lt;/strong&gt; &lt;/span&gt;&lt;/p&gt;\\n&lt;p&gt;&lt;span style=&quot;background-color: transparent;&quot;&gt;In this recipe, you will learn about the first two OOD concepts--object/class and encapsulation. &lt;/span&gt;&lt;/p&gt;\\n&lt;p&gt;&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;strong&gt;Getting ready&lt;/strong&gt; &lt;/span&gt;&lt;/p&gt;\\n&lt;p&gt;&lt;a href=&quot;http://www.packtpub.com/books/content/fasttrack-oop-classes-and-interfaces&quot; target=&quot;_blank&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>\\n <category domain=\"http://www.packtpub.com/taxonomy/term/273\">Application Development</category>\\n <pubDate>Sun, 04 Mar 2018 07:33:30 +0000</pubDate>\\n <dc:creator>Ronit Pawar</dc:creator>\\n <guid isPermaLink=\"false\">32730 at http://www.packtpub.com</guid>\\n</item>\\n<item>\\n <title>Introduction to WordPress Plugin</title>\\n <link>http://www.packtpub.com/books/content/introduction-wordpress-plugin-0</link>\\n <description>&lt;p class=&quot;mce-root&quot;&gt;&lt;span class=&quot;fontstyle0&quot;&gt;In this article,&lt;/span&gt;&lt;strong&gt;&amp;nbsp;Yannick Lefebvre&lt;/strong&gt;&lt;span class=&quot;fontstyle2&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;fontstyle0&quot;&gt;author of &lt;a href=&quot;https://www.packtpub.com/web-development/wordpress-plugin-development-cookbook-second-edition&quot;&gt;&lt;strong&gt;Wordpress Plugin Development Cookbook&lt;/strong&gt;&lt;em&gt;, Second Edition&lt;/em&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;fontstyle2&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;fontstyle0&quot;&gt;we will cover the following recipes:&lt;/span&gt;&lt;/p&gt;\\n&lt;ul&gt;\\n&lt;li class=&quot;mce-root&quot;&gt;Creating a new shortcode with parameters&lt;/li&gt;\\n&lt;li class=&quot;mce-root&quot;&gt;Managing multiple sets of user settings from a single admin page&lt;/li&gt;\\n&lt;/ul&gt;\\n&lt;p style=&quot;margin-left: 40px; margin-right: 40px;&quot; align=&quot;center&quot;&gt;&lt;em&gt;(For more resources related to this topic, see &lt;a href=&quot;#more&quot;&gt;here&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;\\n&lt;p&gt;&lt;a href=&quot;http://www.packtpub.com/books/content/introduction-wordpress-plugin-0&quot; target=&quot;_blank&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>\\n <category domain=\"http://www.packtpub.com/taxonomy/term/268\">Web Development</category>\\n <pubDate>Thu, 22 Feb 2018 09:24:17 +0000</pubDate>\\n <dc:creator>Darshana Ghodke</dc:creator>\\n <guid isPermaLink=\"false\">32641 at http://www.packtpub.com</guid>\\n</item>\\n<item>\\n <title>Exchange Management Shell Common Tasks</title>\\n <link>http://www.packtpub.com/books/content/exchange-management-shell-common-tasks</link>\\n <description>&lt;p&gt;In this article by&lt;strong&gt; Jonas Andersson&lt;/strong&gt;, &lt;strong&gt;Nuno Mota&lt;/strong&gt;, &lt;strong&gt;Michael Pfeiffer&lt;/strong&gt;, the author of the book &lt;a href=&quot;https://www.packtpub.com/networking-and-servers/microsoft-exchange-server-2016-powershell-cookbook-fourth-edition&quot;&gt;&lt;strong&gt;Microsoft Exchange Server 2016 PowerShell Cookbook&lt;/strong&gt;&lt;/a&gt;, they will cover:&lt;/p&gt;\\n&lt;ul&gt;\\n&lt;li&gt;Manually configuring remote PowerShell connections&lt;/li&gt;\\n&lt;li&gt;Using explicit credentials with PowerShell cmdlets&lt;/li&gt;\\n&lt;/ul&gt;\\n&lt;p style=&quot;margin-left: 40px; margin-right: 40px;&quot; align=&quot;center&quot;&gt;&lt;em&gt;(For more resources related to this topic, see &lt;a href=&quot;#more&quot;&gt;here&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;\\n&lt;p&gt;&lt;a href=&quot;http://www.packtpub.com/books/content/exchange-management-shell-common-tasks&quot; target=&quot;_blank&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>\\n <category domain=\"http://www.packtpub.com/taxonomy/term/270\">Networking &amp;amp; Servers</category>\\n <pubDate>Wed, 21 Feb 2018 03:09:23 +0000</pubDate>\\n <dc:creator>Michaelh Henriques</dc:creator>\\n <guid isPermaLink=\"false\">32616 at http://www.packtpub.com</guid>\\n</item>\\n<item>\\n <title>Your First Swift Program</title>\\n <link>http://www.packtpub.com/books/content/your-first-swift-program</link>\\n <description>&lt;p&gt;&amp;nbsp;In this article, by&amp;nbsp;&lt;strong&gt;Keith Moon&lt;/strong&gt; author of the book&amp;nbsp;&lt;a href=&quot;https://www.packtpub.com/application-development/swift-4-programming-cookbook&quot;&gt;Swift 4 Programming Cookbook&lt;/a&gt;, we will learn how to write your first swift program.&lt;/p&gt;\\n&lt;p style=&quot;margin-left: 40px; margin-right: 40px;&quot; align=&quot;center&quot;&gt;&lt;em&gt;(For more resources related to this topic, see &lt;a href=&quot;#more&quot;&gt;here&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;\\n&lt;h1&gt;&lt;strong&gt;Your first Swift program&lt;/strong&gt;&lt;/h1&gt;\\n&lt;p&gt;In this first recipe will be get up and running with Swift using a Swift Playground, and run our first piece of Swift code.&lt;/p&gt;\\n&lt;p&gt;&lt;a href=&quot;http://www.packtpub.com/books/content/your-first-swift-program&quot; target=&quot;_blank&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>\\n <category domain=\"http://www.packtpub.com/taxonomy/term/273\">Application Development</category>\\n <pubDate>Tue, 20 Feb 2018 12:59:09 +0000</pubDate>\\n <dc:creator>Michaelh Henriques</dc:creator>\\n <guid isPermaLink=\"false\">32614 at http://www.packtpub.com</guid>\\n</item>\\n</channel>\\n</rss>\\n'\n"
]
}
],
"source": [
"from urllib.request import urlopen\n",
"try:\n",
" response = urlopen('https://www.packtpub.com/rss.xml')\n",
" xml = response.read()\n",
" print(xml)\n",
" \n",
" response.close()\n",
"\n",
"except:\n",
" print('Unable to connect')"
]
},
{
"cell_type": "code",
"execution_count": 146,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[<img alt=\"Lion, Predator, Dangerous, Mane, Cat\" src=\"https://cdn.pixabay.com/photo/2018/04/13/21/24/lion-3317670__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2018/04/13/21/24/lion-3317670__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/21/24/lion-3317670__480.jpg 2x\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" src=\"https://cdn.pixabay.com/photo/2017/12/26/16/09/lion-3040797__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2017/12/26/16/09/lion-3040797__340.jpg 1x, https://cdn.pixabay.com/photo/2017/12/26/16/09/lion-3040797__480.jpg 2x\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"African Lion, Mane, Close Eyes, Wildlife\" src=\"https://cdn.pixabay.com/photo/2017/10/25/16/54/african-lion-2888519__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2017/10/25/16/54/african-lion-2888519__340.jpg 1x, https://cdn.pixabay.com/photo/2017/10/25/16/54/african-lion-2888519__480.jpg 2x\" title=\"African Lion, Mane, Close Eyes\"/>, <img alt=\"Lion, People, Twins, Sunset, Nature\" src=\"https://cdn.pixabay.com/photo/2018/01/22/21/12/lion-3099986__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2018/01/22/21/12/lion-3099986__340.jpg 1x, https://cdn.pixabay.com/photo/2018/01/22/21/12/lion-3099986__480.jpg 2x\" title=\"Lion, People, Twins, Sunset, Nature\"/>, <img alt=\"Mammal, Wildlife, Cat, Carnivore, Animal\" src=\"https://cdn.pixabay.com/photo/2018/05/06/11/28/mammal-3378346__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2018/05/06/11/28/mammal-3378346__340.jpg 1x, https://cdn.pixabay.com/photo/2018/05/06/11/28/mammal-3378346__480.jpg 2x\" title=\"Mammal, Wildlife, Cat, Carnivore\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" src=\"https://cdn.pixabay.com/photo/2018/05/03/22/34/lion-3372720__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2018/05/03/22/34/lion-3372720__340.jpg 1x, https://cdn.pixabay.com/photo/2018/05/03/22/34/lion-3372720__480.jpg 2x\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Male Carnivore, Young, Wildlife\" src=\"https://cdn.pixabay.com/photo/2018/05/07/22/11/lion-3381790__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2018/05/07/22/11/lion-3381790__340.jpg 1x, https://cdn.pixabay.com/photo/2018/05/07/22/11/lion-3381790__480.jpg 2x\" title=\"Lion, Male Carnivore, Young\"/>, <img alt=\"Lion, Teeth, Roar, Fear, Angry, Roaring\" src=\"https://cdn.pixabay.com/photo/2017/10/24/18/27/lion-2885618__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2017/10/24/18/27/lion-2885618__340.jpg 1x, https://cdn.pixabay.com/photo/2017/10/24/18/27/lion-2885618__480.jpg 2x\" title=\"Lion, Teeth, Roar, Fear, Angry\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" src=\"https://cdn.pixabay.com/photo/2018/04/13/23/35/lion-3317950__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2018/04/13/23/35/lion-3317950__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/23/35/lion-3317950__480.jpg 2x\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Fantasy, Fairy Tales, Girl, Cave, Nature\" src=\"https://cdn.pixabay.com/photo/2018/04/07/23/05/fantasy-3299901__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2018/04/07/23/05/fantasy-3299901__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/07/23/05/fantasy-3299901__480.jpg 2x\" title=\"Fantasy, Fairy Tales, Girl, Cave\"/>, <img alt=\"Lion Wild Africa African Felines Zoo Fauna\" src=\"https://cdn.pixabay.com/photo/2016/01/02/16/53/lion-1118467__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2016/01/02/16/53/lion-1118467__340.jpg 1x, https://cdn.pixabay.com/photo/2016/01/02/16/53/lion-1118467__480.jpg 2x\" title=\"Lion Wild Africa African Felines Zoo\"/>, <img alt=\"Lion, Predator, Sleep, Dangerous, Mane\" src=\"https://cdn.pixabay.com/photo/2018/04/13/20/49/lion-3317566__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2018/04/13/20/49/lion-3317566__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/20/49/lion-3317566__480.jpg 2x\" title=\"Lion, Predator, Sleep, Dangerous\"/>, <img alt=\"Lion White Lion Big Cat Mane Eyes Nature W\" src=\"https://cdn.pixabay.com/photo/2017/03/05/19/10/lion-2119447__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2017/03/05/19/10/lion-2119447__340.jpg 1x, https://cdn.pixabay.com/photo/2017/03/05/19/10/lion-2119447__480.jpg 2x\" title=\"Lion White Lion Big Cat Mane Eyes Nat\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" src=\"https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312614__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312614__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312614__480.jpg 2x\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Figure, Drinking Beer, Sculpture\" src=\"https://cdn.pixabay.com/photo/2018/04/27/13/31/lion-3354739__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2018/04/27/13/31/lion-3354739__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/27/13/31/lion-3354739__480.jpg 2x\" title=\"Lion, Figure, Drinking Beer\"/>, <img alt=\"Lion, Figure, Drinking Beer, Sculpture\" src=\"https://cdn.pixabay.com/photo/2018/04/27/13/31/lion-3354737__340.jpg\" srcset=\"https://cdn.pixabay.com/photo/2018/04/27/13/31/lion-3354737__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/27/13/31/lion-3354737__480.jpg 2x\" title=\"Lion, Figure, Drinking Beer\"/>, <img alt=\"Lion, Predator, Black And White\" data-lazy=\"https://cdn.pixabay.com/photo/2018/03/25/20/17/lion-3260558__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/03/25/20/17/lion-3260558__340.jpg 1x, https://cdn.pixabay.com/photo/2018/03/25/20/17/lion-3260558__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Black And White\"/>, <img alt=\"Fantasy, Rock, Lion Head, Abyss, Woman\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/30/20/40/fantasy-3363980__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/30/20/40/fantasy-3363980__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/30/20/40/fantasy-3363980__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Fantasy, Rock, Lion Head, Abyss\"/>, <img alt=\"Lion, Predator, Yawn, Dangerous, Mane\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/13/21/25/lion-3317673__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/13/21/25/lion-3317673__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/21/25/lion-3317673__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Yawn, Dangerous\"/>, <img alt=\"Lion, Jungle, Savage, Animal, Wildlife\" data-lazy=\"https://cdn.pixabay.com/photo/2018/05/07/21/30/lion-3381704__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/05/07/21/30/lion-3381704__340.jpg 1x, https://cdn.pixabay.com/photo/2018/05/07/21/30/lion-3381704__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Jungle, Savage, Animal\"/>, <img alt=\"Spring Festival, Oktoberfest, Lion\" data-lazy=\"https://cdn.pixabay.com/photo/2018/05/02/11/27/spring-festival-3368386__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/05/02/11/27/spring-festival-3368386__340.jpg 1x, https://cdn.pixabay.com/photo/2018/05/02/11/27/spring-festival-3368386__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Spring Festival, Oktoberfest, Lion\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312615__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312615__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312615__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion Safari Africa Landscape Steppe Sunset\" data-lazy=\"https://cdn.pixabay.com/photo/2014/12/22/10/04/lion-577104__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2014/12/22/10/04/lion-577104__340.jpg 1x, https://cdn.pixabay.com/photo/2014/12/22/10/04/lion-577104__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion Safari Africa Landscape Steppe S\"/>, <img alt=\"Lion Portrait Animal Portrait Face Wild An\" data-lazy=\"https://cdn.pixabay.com/photo/2015/01/30/10/16/lion-617365__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2015/01/30/10/16/lion-617365__340.jpg 1x, https://cdn.pixabay.com/photo/2015/01/30/10/16/lion-617365__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion Portrait Animal Portrait Face Wi\"/>, <img alt=\"Fractalius, Big Cat, Animal\" data-lazy=\"https://cdn.pixabay.com/photo/2018/03/28/19/59/fractalius-3270346__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/03/28/19/59/fractalius-3270346__340.jpg 1x, https://cdn.pixabay.com/photo/2018/03/28/19/59/fractalius-3270346__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Fractalius, Big Cat, Animal\"/>, <img alt=\"Spring Festival, Oktoberfest, Lion\" data-lazy=\"https://cdn.pixabay.com/photo/2018/05/02/11/28/spring-festival-3368390__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/05/02/11/28/spring-festival-3368390__340.jpg 1x, https://cdn.pixabay.com/photo/2018/05/02/11/28/spring-festival-3368390__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Spring Festival, Oktoberfest, Lion\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/23/15/34/lion-3344600__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/23/15/34/lion-3344600__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/23/15/34/lion-3344600__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/14/00/10/lion-3318016__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/14/00/10/lion-3318016__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/00/10/lion-3318016__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lions, Cubs, Pair, Cute, Jungle, Nature\" data-lazy=\"https://cdn.pixabay.com/photo/2017/09/01/01/39/lions-2702828__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2017/09/01/01/39/lions-2702828__340.jpg 1x, https://cdn.pixabay.com/photo/2017/09/01/01/39/lions-2702828__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lions, Cubs, Pair, Cute, Jungle\"/>, <img alt=\"Animal, Colorful, Decoration, Lion\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/24/05/34/animal-3346331__340.png\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/24/05/34/animal-3346331__340.png 1x, https://cdn.pixabay.com/photo/2018/04/24/05/34/animal-3346331__480.png 2x\" src=\"/static/img/blank.gif\" title=\"Animal, Colorful, Decoration, Lion\"/>, <img alt=\"Lion, Predator, Mammal, Nature, Animal\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/17/15/35/lion-3327806__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/17/15/35/lion-3327806__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/17/15/35/lion-3327806__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Mammal, Nature\"/>, <img alt=\"African Lion Lion Male Mane Lazy Cat Anima\" data-lazy=\"https://cdn.pixabay.com/photo/2015/09/22/14/34/african-lion-951778__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2015/09/22/14/34/african-lion-951778__340.jpg 1x, https://cdn.pixabay.com/photo/2015/09/22/14/34/african-lion-951778__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"African Lion Lion Male Mane Lazy Cat\"/>, <img alt=\"Lion, Roar, Africa, Animal, Wildcat\" data-lazy=\"https://cdn.pixabay.com/photo/2017/12/11/15/34/lion-3012515__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2017/12/11/15/34/lion-3012515__340.jpg 1x, https://cdn.pixabay.com/photo/2017/12/11/15/34/lion-3012515__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Roar, Africa, Animal, Wildcat\"/>, <img alt=\"Lion Wild Animal Abstract Background Funny\" data-lazy=\"https://cdn.pixabay.com/photo/2015/10/31/09/57/lion-1015153__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2015/10/31/09/57/lion-1015153__340.jpg 1x, https://cdn.pixabay.com/photo/2015/10/31/09/57/lion-1015153__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion Wild Animal Abstract Background\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/10/19/46/lion-3308557__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/10/19/46/lion-3308557__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/10/19/46/lion-3308557__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/23/14/27/lion-3344376__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/23/14/27/lion-3344376__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/23/14/27/lion-3344376__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Cat, Predator, Big Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/03/18/07/05/lion-3235915__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/03/18/07/05/lion-3235915__340.jpg 1x, https://cdn.pixabay.com/photo/2018/03/18/07/05/lion-3235915__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Cat, Predator, Big Cat\"/>, <img alt=\"Lion, Young, Puppies, Run, Animal World\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/23/22/54/lion-3345894__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/23/22/54/lion-3345894__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/23/22/54/lion-3345894__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Young, Puppies, Run\"/>, <img alt=\"Goal, Portal, Door, Input, Gate\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/27/23/05/goal-3356122__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/27/23/05/goal-3356122__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/27/23/05/goal-3356122__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Goal, Portal, Door, Input, Gate\"/>, <img alt=\"Lion, Animal World, Cat, Nature\" data-lazy=\"https://cdn.pixabay.com/photo/2018/05/01/23/52/lion-3367342__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/05/01/23/52/lion-3367342__340.jpg 1x, https://cdn.pixabay.com/photo/2018/05/01/23/52/lion-3367342__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Animal World, Cat, Nature\"/>, <img alt=\"Seal, Sea Lion, Swim, Water, Robbe\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/10/01/13/seal-3306089__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/10/01/13/seal-3306089__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/10/01/13/seal-3306089__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Seal, Sea Lion, Swim, Water, Robbe\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/09/19/02/lion-3305119__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/09/19/02/lion-3305119__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/09/19/02/lion-3305119__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/11/19/33/lion-3311537__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/11/19/33/lion-3311537__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/11/19/33/lion-3311537__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/14/18/43/lion-3319745__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/14/18/43/lion-3319745__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/18/43/lion-3319745__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion Animal Nature Predator Big Cat Wild P\" data-lazy=\"https://cdn.pixabay.com/photo/2014/12/12/19/45/lion-565820__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2014/12/12/19/45/lion-565820__340.jpg 1x, https://cdn.pixabay.com/photo/2014/12/12/19/45/lion-565820__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion Animal Nature Predator Big Cat W\"/>, <img alt=\"Lion Animal Portrait Africa Safari Wild An\" data-lazy=\"https://cdn.pixabay.com/photo/2015/01/04/10/46/lion-588144__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2015/01/04/10/46/lion-588144__340.jpg 1x, https://cdn.pixabay.com/photo/2015/01/04/10/46/lion-588144__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion Animal Portrait Africa Safari Wi\"/>, <img alt=\"Lion Animal Predator Big Cat Wild Panthera\" data-lazy=\"https://cdn.pixabay.com/photo/2014/12/12/19/43/lion-565818__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2014/12/12/19/43/lion-565818__340.jpg 1x, https://cdn.pixabay.com/photo/2014/12/12/19/43/lion-565818__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion Animal Predator Big Cat Wild Pan\"/>, <img alt=\"Lion, Predator, Animal, Zoo\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/04/15/55/lion-3290180__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/04/15/55/lion-3290180__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/04/15/55/lion-3290180__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Animal, Zoo\"/>, <img alt=\"Lions Zoo Animal Lions Lions Lions Lions L\" data-lazy=\"https://cdn.pixabay.com/photo/2016/09/10/19/56/lions-1660044__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2016/09/10/19/56/lions-1660044__340.jpg 1x, https://cdn.pixabay.com/photo/2016/09/10/19/56/lions-1660044__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lions Zoo Animal Lions Lions Lions Li\"/>, <img alt=\"Lion Big Cat Big Cat Wildlife Wild Carnivo\" data-lazy=\"https://cdn.pixabay.com/photo/2016/09/09/20/01/lion-1657957__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2016/09/09/20/01/lion-1657957__340.jpg 1x, https://cdn.pixabay.com/photo/2016/09/09/20/01/lion-1657957__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion Big Cat Big Cat Wildlife Wild Ca\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/13/23/45/lion-3317956__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/13/23/45/lion-3317956__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/23/45/lion-3317956__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/13/13/24/lion-3316533__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/13/13/24/lion-3316533__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/13/24/lion-3316533__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Seal, Sea Lion, Water, Robbe\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/14/20/50/seal-3320074__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/14/20/50/seal-3320074__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/20/50/seal-3320074__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Seal, Sea Lion, Water, Robbe\"/>, <img alt=\"Lion Big Cat Predator Safari Wilderness Wi\" data-lazy=\"https://cdn.pixabay.com/photo/2014/11/03/11/07/lion-515028__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2014/11/03/11/07/lion-515028__340.jpg 1x, https://cdn.pixabay.com/photo/2014/11/03/11/07/lion-515028__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion Big Cat Predator Safari Wilderne\"/>, <img alt=\"Sky, Nature, Landscape, Fantasy\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/11/20/56/sky-3311762__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/11/20/56/sky-3311762__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/11/20/56/sky-3311762__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Sky, Nature, Landscape, Fantasy\"/>, <img alt=\"Seal, Sea Lion, Water, Robbe\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/14/20/06/seal-3319927__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/14/20/06/seal-3319927__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/20/06/seal-3319927__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Seal, Sea Lion, Water, Robbe\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312613__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312613__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312613__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Predator, Black And White\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/14/01/10/lion-3318110__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/14/01/10/lion-3318110__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/01/10/lion-3318110__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Black And White\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/13/21/17/lion-3317661__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/13/21/17/lion-3317661__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/21/17/lion-3317661__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/13/23/44/lion-3317955__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/13/23/44/lion-3317955__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/23/44/lion-3317955__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/14/00/01/lion-3317998__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/14/00/01/lion-3317998__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/00/01/lion-3317998__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Cat, Predator, Big Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/03/10/13/40/lion-3214071__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/03/10/13/40/lion-3214071__340.jpg 1x, https://cdn.pixabay.com/photo/2018/03/10/13/40/lion-3214071__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Cat, Predator, Big Cat\"/>, <img alt=\"Seal, Sea Lion, Water, Robbe\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/14/19/54/seal-3319900__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/14/19/54/seal-3319900__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/19/54/seal-3319900__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Seal, Sea Lion, Water, Robbe\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/14/00/46/lion-3318081__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/14/00/46/lion-3318081__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/00/46/lion-3318081__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Cat, Predator, Big Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/03/23/08/52/lion-3253084__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/03/23/08/52/lion-3253084__340.jpg 1x, https://cdn.pixabay.com/photo/2018/03/23/08/52/lion-3253084__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Cat, Predator, Big Cat\"/>, <img alt=\"Lion, Cat, Predator, Big Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/01/21/09/47/lion-3096191__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/01/21/09/47/lion-3096191__340.jpg 1x, https://cdn.pixabay.com/photo/2018/01/21/09/47/lion-3096191__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Cat, Predator, Big Cat\"/>, <img alt=\"Lion, Predator, Sleep, Cozy, Rest\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/11/19/33/lion-3311536__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/11/19/33/lion-3311536__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/11/19/33/lion-3311536__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Sleep, Cozy, Rest\"/>, <img alt=\"Lion Etosha Namibia Africa Safari Lion Cub\" data-lazy=\"https://cdn.pixabay.com/photo/2016/04/03/22/41/lion-1305797__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2016/04/03/22/41/lion-1305797__340.jpg 1x, https://cdn.pixabay.com/photo/2016/04/03/22/41/lion-1305797__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion Etosha Namibia Africa Safari Lio\"/>, <img alt=\"Seal, Sea Lion, Water, Robbe\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/14/21/00/seal-3320110__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/14/21/00/seal-3320110__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/21/00/seal-3320110__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Seal, Sea Lion, Water, Robbe\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2017/12/30/11/54/lion-3049884__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2017/12/30/11/54/lion-3049884__340.jpg 1x, https://cdn.pixabay.com/photo/2017/12/30/11/54/lion-3049884__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Tiger, Predator, Animal World, Mammal\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/26/19/24/tiger-3352857__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/26/19/24/tiger-3352857__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/26/19/24/tiger-3352857__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Tiger, Predator, Animal World\"/>, <img alt=\"Seal, Sea Lion, Water, Robbe\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/11/21/48/seal-3311891__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/11/21/48/seal-3311891__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/11/21/48/seal-3311891__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Seal, Sea Lion, Water, Robbe\"/>, <img alt=\"Lion, Zoo, Feline, Wild, Tawny\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/14/17/23/lion-3319487__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/14/17/23/lion-3319487__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/17/23/lion-3319487__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Zoo, Feline, Wild, Tawny\"/>, <img alt=\"Seal, Sea Lion, Water, Robbe\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/23/16/52/seal-3344872__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/23/16/52/seal-3344872__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/23/16/52/seal-3344872__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Seal, Sea Lion, Water, Robbe\"/>, <img alt=\"Lion, Cat, Predator, Big Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/01/09/18/06/lion-3072184__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/01/09/18/06/lion-3072184__340.jpg 1x, https://cdn.pixabay.com/photo/2018/01/09/18/06/lion-3072184__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Cat, Predator, Big Cat\"/>, <img alt=\"Lion Wildcat Safari Africa Animal World Wi\" data-lazy=\"https://cdn.pixabay.com/photo/2014/11/03/11/10/lion-515030__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2014/11/03/11/10/lion-515030__340.jpg 1x, https://cdn.pixabay.com/photo/2014/11/03/11/10/lion-515030__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion Wildcat Safari Africa Animal Wor\"/>, <img alt=\"Lion Panthera Leo Lioness Animal World Afr\" data-lazy=\"https://cdn.pixabay.com/photo/2015/04/14/08/52/lion-721836__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2015/04/14/08/52/lion-721836__340.jpg 1x, https://cdn.pixabay.com/photo/2015/04/14/08/52/lion-721836__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion Panthera Leo Lioness Animal Worl\"/>, <img alt=\"Lion, Savannah, Nature, Predator, Dusk\" data-lazy=\"https://cdn.pixabay.com/photo/2018/03/30/22/09/lion-3276692__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/03/30/22/09/lion-3276692__340.jpg 1x, https://cdn.pixabay.com/photo/2018/03/30/22/09/lion-3276692__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Savannah, Nature, Predator\"/>, <img alt=\"Sea Lion, Feeding, Sea Animal\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/30/17/39/sea-lion-3363402__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/30/17/39/sea-lion-3363402__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/30/17/39/sea-lion-3363402__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Sea Lion, Feeding, Sea Animal\"/>, <img alt=\"Lion, Animal, Pets, Vintage Lion\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/06/23/18/lion-3297303__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/06/23/18/lion-3297303__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/06/23/18/lion-3297303__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Animal, Pets, Vintage Lion\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/09/19/03/lion-3305122__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/09/19/03/lion-3305122__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/09/19/03/lion-3305122__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Lion, Cute, Sketch, Funny\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/19/21/17/lion-3334357__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/19/21/17/lion-3334357__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/19/21/17/lion-3334357__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Cute, Sketch, Funny\"/>, <img alt=\"White Lion, Eyes, Lion, Shadows\" data-lazy=\"https://cdn.pixabay.com/photo/2017/10/25/21/05/white-lion-2889308__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2017/10/25/21/05/white-lion-2889308__340.jpg 1x, https://cdn.pixabay.com/photo/2017/10/25/21/05/white-lion-2889308__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"White Lion, Eyes, Lion, Shadows\"/>, <img alt=\"Seal, Sea Lion, Water, Robbe\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/14/20/46/seal-3320055__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/14/20/46/seal-3320055__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/20/46/seal-3320055__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Seal, Sea Lion, Water, Robbe\"/>, <img alt=\"Lion, Predator, Dangerous, Mane, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/14/00/47/lion-3318085__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/14/00/47/lion-3318085__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/00/47/lion-3318085__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion, Predator, Dangerous, Mane\"/>, <img alt=\"Cat Lion Shadow Carnivore Big Leo Nature M\" data-lazy=\"https://cdn.pixabay.com/photo/2014/12/11/13/31/cat-564202__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2014/12/11/13/31/cat-564202__340.jpg 1x, https://cdn.pixabay.com/photo/2014/12/11/13/31/cat-564202__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Cat Lion Shadow Carnivore Big Leo Nat\"/>, <img alt=\"Mammal, Animal, Nature, Animal World\" data-lazy=\"https://cdn.pixabay.com/photo/2018/02/03/20/23/mammal-3128440__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/02/03/20/23/mammal-3128440__340.jpg 1x, https://cdn.pixabay.com/photo/2018/02/03/20/23/mammal-3128440__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Mammal, Animal, Nature\"/>, <img alt=\"Lion Panthera Leo Lioness Animal World Afr\" data-lazy=\"https://cdn.pixabay.com/photo/2014/05/11/10/26/lion-341717__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2014/05/11/10/26/lion-341717__340.jpg 1x, https://cdn.pixabay.com/photo/2014/05/11/10/26/lion-341717__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion Panthera Leo Lioness Animal Worl\"/>, <img alt=\"Seal, Sea Lion, Water, Robbe\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/14/20/48/seal-3320065__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/14/20/48/seal-3320065__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/20/48/seal-3320065__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Seal, Sea Lion, Water, Robbe\"/>, <img alt=\"Lion Lion Cub Cat Big Cat Animal Africa Wi\" data-lazy=\"https://cdn.pixabay.com/photo/2016/07/27/10/41/lion-1544990__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2016/07/27/10/41/lion-1544990__340.jpg 1x, https://cdn.pixabay.com/photo/2016/07/27/10/41/lion-1544990__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion Lion Cub Cat Big Cat Animal Afri\"/>, <img alt=\"Wild World, Lion, Nature, Fur, Cat\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/25/10/40/wild-world-3349200__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/25/10/40/wild-world-3349200__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/25/10/40/wild-world-3349200__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Wild World, Lion, Nature, Fur, Cat\"/>, <img alt=\"Goal, Portal, Door, Input, Gate\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/27/23/08/goal-3356125__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/27/23/08/goal-3356125__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/27/23/08/goal-3356125__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Goal, Portal, Door, Input, Gate\"/>, <img alt=\"Cat, Lion, Wildlife, Mammal, Carnivore\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/21/22/20/cat-3339712__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/21/22/20/cat-3339712__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/21/22/20/cat-3339712__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Cat, Lion, Wildlife, Mammal\"/>, <img alt=\"Mammals, Portrait, Cat, Nature, Lion\" data-lazy=\"https://cdn.pixabay.com/photo/2018/03/21/19/45/mammals-3247970__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/03/21/19/45/mammals-3247970__340.jpg 1x, https://cdn.pixabay.com/photo/2018/03/21/19/45/mammals-3247970__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Mammals, Portrait, Cat, Nature\"/>, <img alt=\"Lion Predator Big Cat Safari Africa Animal\" data-lazy=\"https://cdn.pixabay.com/photo/2014/11/03/11/10/lion-515029__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2014/11/03/11/10/lion-515029__340.jpg 1x, https://cdn.pixabay.com/photo/2014/11/03/11/10/lion-515029__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Lion Predator Big Cat Safari Africa A\"/>, <img alt=\"Nature, Animal, Animal World, Lion\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/26/00/19/nature-3350998__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/26/00/19/nature-3350998__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/26/00/19/nature-3350998__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Nature, Animal, Animal World, Lion\"/>, <img alt=\"Seal, Sea Lion, Water, Robbe\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/14/21/08/seal-3320143__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/14/21/08/seal-3320143__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/21/08/seal-3320143__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Seal, Sea Lion, Water, Robbe\"/>, <img alt=\"Cat, Lion, Mammal, Wildlife, Carnivore\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/30/09/44/cat-3362252__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/30/09/44/cat-3362252__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/30/09/44/cat-3362252__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Cat, Lion, Mammal, Wildlife\"/>, <img alt=\"Sculpture, Lion, Bronze, Pride, Animal\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/30/16/44/sculpture-3363214__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/30/16/44/sculpture-3363214__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/30/16/44/sculpture-3363214__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Sculpture, Lion, Bronze, Pride\"/>, <img alt=\"Seal, Sea Lion, Sleep, Water, Robbe\" data-lazy=\"https://cdn.pixabay.com/photo/2018/04/11/20/35/seal-3311713__340.jpg\" data-lazy-srcset=\"https://cdn.pixabay.com/photo/2018/04/11/20/35/seal-3311713__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/11/20/35/seal-3311713__480.jpg 2x\" src=\"/static/img/blank.gif\" title=\"Seal, Sea Lion, Sleep, Water, Robbe\"/>]\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2018/04/13/21/24/lion-3317670__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/21/24/lion-3317670__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2018/04/13/21/24/lion-3317670__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"https://cdn.pixabay.com/photo/2018/04/13/21/24/lion-3317670__340.jpg lion-3317670__340.jpg\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'srcset': 'https://cdn.pixabay.com/photo/2017/12/26/16/09/lion-3040797__340.jpg 1x, https://cdn.pixabay.com/photo/2017/12/26/16/09/lion-3040797__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2017/12/26/16/09/lion-3040797__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"https://cdn.pixabay.com/photo/2017/12/26/16/09/lion-3040797__340.jpg lion-3040797__340.jpg\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2017/10/25/16/54/african-lion-2888519__340.jpg 1x, https://cdn.pixabay.com/photo/2017/10/25/16/54/african-lion-2888519__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2017/10/25/16/54/african-lion-2888519__340.jpg', 'alt': 'African Lion, Mane, Close Eyes, Wildlife', 'title': 'African Lion, Mane, Close Eyes'}\n",
"https://cdn.pixabay.com/photo/2017/10/25/16/54/african-lion-2888519__340.jpg african-lion-2888519__340.jpg\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2018/01/22/21/12/lion-3099986__340.jpg 1x, https://cdn.pixabay.com/photo/2018/01/22/21/12/lion-3099986__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2018/01/22/21/12/lion-3099986__340.jpg', 'alt': 'Lion, People, Twins, Sunset, Nature', 'title': 'Lion, People, Twins, Sunset, Nature'}\n",
"https://cdn.pixabay.com/photo/2018/01/22/21/12/lion-3099986__340.jpg lion-3099986__340.jpg\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2018/05/06/11/28/mammal-3378346__340.jpg 1x, https://cdn.pixabay.com/photo/2018/05/06/11/28/mammal-3378346__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2018/05/06/11/28/mammal-3378346__340.jpg', 'alt': 'Mammal, Wildlife, Cat, Carnivore, Animal', 'title': 'Mammal, Wildlife, Cat, Carnivore'}\n",
"https://cdn.pixabay.com/photo/2018/05/06/11/28/mammal-3378346__340.jpg mammal-3378346__340.jpg\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2018/05/03/22/34/lion-3372720__340.jpg 1x, https://cdn.pixabay.com/photo/2018/05/03/22/34/lion-3372720__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2018/05/03/22/34/lion-3372720__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"https://cdn.pixabay.com/photo/2018/05/03/22/34/lion-3372720__340.jpg lion-3372720__340.jpg\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2018/05/07/22/11/lion-3381790__340.jpg 1x, https://cdn.pixabay.com/photo/2018/05/07/22/11/lion-3381790__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2018/05/07/22/11/lion-3381790__340.jpg', 'alt': 'Lion, Male Carnivore, Young, Wildlife', 'title': 'Lion, Male Carnivore, Young'}\n",
"https://cdn.pixabay.com/photo/2018/05/07/22/11/lion-3381790__340.jpg lion-3381790__340.jpg\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2017/10/24/18/27/lion-2885618__340.jpg 1x, https://cdn.pixabay.com/photo/2017/10/24/18/27/lion-2885618__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2017/10/24/18/27/lion-2885618__340.jpg', 'alt': 'Lion, Teeth, Roar, Fear, Angry, Roaring', 'title': 'Lion, Teeth, Roar, Fear, Angry'}\n",
"https://cdn.pixabay.com/photo/2017/10/24/18/27/lion-2885618__340.jpg lion-2885618__340.jpg\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2018/04/13/23/35/lion-3317950__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/23/35/lion-3317950__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2018/04/13/23/35/lion-3317950__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"https://cdn.pixabay.com/photo/2018/04/13/23/35/lion-3317950__340.jpg lion-3317950__340.jpg\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2018/04/07/23/05/fantasy-3299901__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/07/23/05/fantasy-3299901__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2018/04/07/23/05/fantasy-3299901__340.jpg', 'alt': 'Fantasy, Fairy Tales, Girl, Cave, Nature', 'title': 'Fantasy, Fairy Tales, Girl, Cave'}\n",
"https://cdn.pixabay.com/photo/2018/04/07/23/05/fantasy-3299901__340.jpg fantasy-3299901__340.jpg\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2016/01/02/16/53/lion-1118467__340.jpg 1x, https://cdn.pixabay.com/photo/2016/01/02/16/53/lion-1118467__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2016/01/02/16/53/lion-1118467__340.jpg', 'alt': 'Lion Wild Africa African Felines Zoo Fauna', 'title': 'Lion Wild Africa African Felines Zoo'}\n",
"https://cdn.pixabay.com/photo/2016/01/02/16/53/lion-1118467__340.jpg lion-1118467__340.jpg\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2018/04/13/20/49/lion-3317566__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/20/49/lion-3317566__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2018/04/13/20/49/lion-3317566__340.jpg', 'alt': 'Lion, Predator, Sleep, Dangerous, Mane', 'title': 'Lion, Predator, Sleep, Dangerous'}\n",
"https://cdn.pixabay.com/photo/2018/04/13/20/49/lion-3317566__340.jpg lion-3317566__340.jpg\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2017/03/05/19/10/lion-2119447__340.jpg 1x, https://cdn.pixabay.com/photo/2017/03/05/19/10/lion-2119447__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2017/03/05/19/10/lion-2119447__340.jpg', 'alt': 'Lion White Lion Big Cat Mane Eyes Nature W', 'title': 'Lion White Lion Big Cat Mane Eyes Nat'}\n",
"https://cdn.pixabay.com/photo/2017/03/05/19/10/lion-2119447__340.jpg lion-2119447__340.jpg\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312614__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312614__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312614__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312614__340.jpg lion-3312614__340.jpg\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2018/04/27/13/31/lion-3354739__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/27/13/31/lion-3354739__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2018/04/27/13/31/lion-3354739__340.jpg', 'alt': 'Lion, Figure, Drinking Beer, Sculpture', 'title': 'Lion, Figure, Drinking Beer'}\n",
"https://cdn.pixabay.com/photo/2018/04/27/13/31/lion-3354739__340.jpg lion-3354739__340.jpg\n",
"{'srcset': 'https://cdn.pixabay.com/photo/2018/04/27/13/31/lion-3354737__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/27/13/31/lion-3354737__480.jpg 2x', 'src': 'https://cdn.pixabay.com/photo/2018/04/27/13/31/lion-3354737__340.jpg', 'alt': 'Lion, Figure, Drinking Beer, Sculpture', 'title': 'Lion, Figure, Drinking Beer'}\n",
"https://cdn.pixabay.com/photo/2018/04/27/13/31/lion-3354737__340.jpg lion-3354737__340.jpg\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/03/25/20/17/lion-3260558__340.jpg 1x, https://cdn.pixabay.com/photo/2018/03/25/20/17/lion-3260558__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/03/25/20/17/lion-3260558__340.jpg', 'alt': 'Lion, Predator, Black And White', 'title': 'Lion, Predator, Black And White'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/30/20/40/fantasy-3363980__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/30/20/40/fantasy-3363980__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/30/20/40/fantasy-3363980__340.jpg', 'alt': 'Fantasy, Rock, Lion Head, Abyss, Woman', 'title': 'Fantasy, Rock, Lion Head, Abyss'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/13/21/25/lion-3317673__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/21/25/lion-3317673__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/13/21/25/lion-3317673__340.jpg', 'alt': 'Lion, Predator, Yawn, Dangerous, Mane', 'title': 'Lion, Predator, Yawn, Dangerous'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/05/07/21/30/lion-3381704__340.jpg 1x, https://cdn.pixabay.com/photo/2018/05/07/21/30/lion-3381704__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/05/07/21/30/lion-3381704__340.jpg', 'alt': 'Lion, Jungle, Savage, Animal, Wildlife', 'title': 'Lion, Jungle, Savage, Animal'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/05/02/11/27/spring-festival-3368386__340.jpg 1x, https://cdn.pixabay.com/photo/2018/05/02/11/27/spring-festival-3368386__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/05/02/11/27/spring-festival-3368386__340.jpg', 'alt': 'Spring Festival, Oktoberfest, Lion', 'title': 'Spring Festival, Oktoberfest, Lion'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312615__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312615__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312615__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2014/12/22/10/04/lion-577104__340.jpg 1x, https://cdn.pixabay.com/photo/2014/12/22/10/04/lion-577104__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2014/12/22/10/04/lion-577104__340.jpg', 'alt': 'Lion Safari Africa Landscape Steppe Sunset', 'title': 'Lion Safari Africa Landscape Steppe S'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2015/01/30/10/16/lion-617365__340.jpg 1x, https://cdn.pixabay.com/photo/2015/01/30/10/16/lion-617365__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2015/01/30/10/16/lion-617365__340.jpg', 'alt': 'Lion Portrait Animal Portrait Face Wild An', 'title': 'Lion Portrait Animal Portrait Face Wi'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/03/28/19/59/fractalius-3270346__340.jpg 1x, https://cdn.pixabay.com/photo/2018/03/28/19/59/fractalius-3270346__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/03/28/19/59/fractalius-3270346__340.jpg', 'alt': 'Fractalius, Big Cat, Animal', 'title': 'Fractalius, Big Cat, Animal'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/05/02/11/28/spring-festival-3368390__340.jpg 1x, https://cdn.pixabay.com/photo/2018/05/02/11/28/spring-festival-3368390__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/05/02/11/28/spring-festival-3368390__340.jpg', 'alt': 'Spring Festival, Oktoberfest, Lion', 'title': 'Spring Festival, Oktoberfest, Lion'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/23/15/34/lion-3344600__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/23/15/34/lion-3344600__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/23/15/34/lion-3344600__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/14/00/10/lion-3318016__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/00/10/lion-3318016__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/14/00/10/lion-3318016__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2017/09/01/01/39/lions-2702828__340.jpg 1x, https://cdn.pixabay.com/photo/2017/09/01/01/39/lions-2702828__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2017/09/01/01/39/lions-2702828__340.jpg', 'alt': 'Lions, Cubs, Pair, Cute, Jungle, Nature', 'title': 'Lions, Cubs, Pair, Cute, Jungle'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/24/05/34/animal-3346331__340.png 1x, https://cdn.pixabay.com/photo/2018/04/24/05/34/animal-3346331__480.png 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/24/05/34/animal-3346331__340.png', 'alt': 'Animal, Colorful, Decoration, Lion', 'title': 'Animal, Colorful, Decoration, Lion'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/17/15/35/lion-3327806__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/17/15/35/lion-3327806__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/17/15/35/lion-3327806__340.jpg', 'alt': 'Lion, Predator, Mammal, Nature, Animal', 'title': 'Lion, Predator, Mammal, Nature'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2015/09/22/14/34/african-lion-951778__340.jpg 1x, https://cdn.pixabay.com/photo/2015/09/22/14/34/african-lion-951778__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2015/09/22/14/34/african-lion-951778__340.jpg', 'alt': 'African Lion Lion Male Mane Lazy Cat Anima', 'title': 'African Lion Lion Male Mane Lazy Cat'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2017/12/11/15/34/lion-3012515__340.jpg 1x, https://cdn.pixabay.com/photo/2017/12/11/15/34/lion-3012515__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2017/12/11/15/34/lion-3012515__340.jpg', 'alt': 'Lion, Roar, Africa, Animal, Wildcat', 'title': 'Lion, Roar, Africa, Animal, Wildcat'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2015/10/31/09/57/lion-1015153__340.jpg 1x, https://cdn.pixabay.com/photo/2015/10/31/09/57/lion-1015153__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2015/10/31/09/57/lion-1015153__340.jpg', 'alt': 'Lion Wild Animal Abstract Background Funny', 'title': 'Lion Wild Animal Abstract Background'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/10/19/46/lion-3308557__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/10/19/46/lion-3308557__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/10/19/46/lion-3308557__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/23/14/27/lion-3344376__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/23/14/27/lion-3344376__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/23/14/27/lion-3344376__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/03/18/07/05/lion-3235915__340.jpg 1x, https://cdn.pixabay.com/photo/2018/03/18/07/05/lion-3235915__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/03/18/07/05/lion-3235915__340.jpg', 'alt': 'Lion, Cat, Predator, Big Cat', 'title': 'Lion, Cat, Predator, Big Cat'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/23/22/54/lion-3345894__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/23/22/54/lion-3345894__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/23/22/54/lion-3345894__340.jpg', 'alt': 'Lion, Young, Puppies, Run, Animal World', 'title': 'Lion, Young, Puppies, Run'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/27/23/05/goal-3356122__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/27/23/05/goal-3356122__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/27/23/05/goal-3356122__340.jpg', 'alt': 'Goal, Portal, Door, Input, Gate', 'title': 'Goal, Portal, Door, Input, Gate'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/05/01/23/52/lion-3367342__340.jpg 1x, https://cdn.pixabay.com/photo/2018/05/01/23/52/lion-3367342__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/05/01/23/52/lion-3367342__340.jpg', 'alt': 'Lion, Animal World, Cat, Nature', 'title': 'Lion, Animal World, Cat, Nature'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/10/01/13/seal-3306089__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/10/01/13/seal-3306089__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/10/01/13/seal-3306089__340.jpg', 'alt': 'Seal, Sea Lion, Swim, Water, Robbe', 'title': 'Seal, Sea Lion, Swim, Water, Robbe'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/09/19/02/lion-3305119__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/09/19/02/lion-3305119__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/09/19/02/lion-3305119__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/11/19/33/lion-3311537__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/11/19/33/lion-3311537__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/11/19/33/lion-3311537__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/14/18/43/lion-3319745__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/18/43/lion-3319745__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/14/18/43/lion-3319745__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2014/12/12/19/45/lion-565820__340.jpg 1x, https://cdn.pixabay.com/photo/2014/12/12/19/45/lion-565820__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2014/12/12/19/45/lion-565820__340.jpg', 'alt': 'Lion Animal Nature Predator Big Cat Wild P', 'title': 'Lion Animal Nature Predator Big Cat W'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2015/01/04/10/46/lion-588144__340.jpg 1x, https://cdn.pixabay.com/photo/2015/01/04/10/46/lion-588144__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2015/01/04/10/46/lion-588144__340.jpg', 'alt': 'Lion Animal Portrait Africa Safari Wild An', 'title': 'Lion Animal Portrait Africa Safari Wi'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2014/12/12/19/43/lion-565818__340.jpg 1x, https://cdn.pixabay.com/photo/2014/12/12/19/43/lion-565818__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2014/12/12/19/43/lion-565818__340.jpg', 'alt': 'Lion Animal Predator Big Cat Wild Panthera', 'title': 'Lion Animal Predator Big Cat Wild Pan'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/04/15/55/lion-3290180__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/04/15/55/lion-3290180__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/04/15/55/lion-3290180__340.jpg', 'alt': 'Lion, Predator, Animal, Zoo', 'title': 'Lion, Predator, Animal, Zoo'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2016/09/10/19/56/lions-1660044__340.jpg 1x, https://cdn.pixabay.com/photo/2016/09/10/19/56/lions-1660044__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2016/09/10/19/56/lions-1660044__340.jpg', 'alt': 'Lions Zoo Animal Lions Lions Lions Lions L', 'title': 'Lions Zoo Animal Lions Lions Lions Li'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2016/09/09/20/01/lion-1657957__340.jpg 1x, https://cdn.pixabay.com/photo/2016/09/09/20/01/lion-1657957__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2016/09/09/20/01/lion-1657957__340.jpg', 'alt': 'Lion Big Cat Big Cat Wildlife Wild Carnivo', 'title': 'Lion Big Cat Big Cat Wildlife Wild Ca'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/13/23/45/lion-3317956__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/23/45/lion-3317956__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/13/23/45/lion-3317956__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/13/13/24/lion-3316533__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/13/24/lion-3316533__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/13/13/24/lion-3316533__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/14/20/50/seal-3320074__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/20/50/seal-3320074__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/14/20/50/seal-3320074__340.jpg', 'alt': 'Seal, Sea Lion, Water, Robbe', 'title': 'Seal, Sea Lion, Water, Robbe'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2014/11/03/11/07/lion-515028__340.jpg 1x, https://cdn.pixabay.com/photo/2014/11/03/11/07/lion-515028__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2014/11/03/11/07/lion-515028__340.jpg', 'alt': 'Lion Big Cat Predator Safari Wilderness Wi', 'title': 'Lion Big Cat Predator Safari Wilderne'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/11/20/56/sky-3311762__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/11/20/56/sky-3311762__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/11/20/56/sky-3311762__340.jpg', 'alt': 'Sky, Nature, Landscape, Fantasy', 'title': 'Sky, Nature, Landscape, Fantasy'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/14/20/06/seal-3319927__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/20/06/seal-3319927__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/14/20/06/seal-3319927__340.jpg', 'alt': 'Seal, Sea Lion, Water, Robbe', 'title': 'Seal, Sea Lion, Water, Robbe'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312613__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312613__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/12/06/23/lion-3312613__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/14/01/10/lion-3318110__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/01/10/lion-3318110__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/14/01/10/lion-3318110__340.jpg', 'alt': 'Lion, Predator, Black And White', 'title': 'Lion, Predator, Black And White'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/13/21/17/lion-3317661__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/21/17/lion-3317661__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/13/21/17/lion-3317661__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/13/23/44/lion-3317955__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/13/23/44/lion-3317955__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/13/23/44/lion-3317955__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/14/00/01/lion-3317998__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/00/01/lion-3317998__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/14/00/01/lion-3317998__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/03/10/13/40/lion-3214071__340.jpg 1x, https://cdn.pixabay.com/photo/2018/03/10/13/40/lion-3214071__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/03/10/13/40/lion-3214071__340.jpg', 'alt': 'Lion, Cat, Predator, Big Cat', 'title': 'Lion, Cat, Predator, Big Cat'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/14/19/54/seal-3319900__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/19/54/seal-3319900__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/14/19/54/seal-3319900__340.jpg', 'alt': 'Seal, Sea Lion, Water, Robbe', 'title': 'Seal, Sea Lion, Water, Robbe'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/14/00/46/lion-3318081__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/00/46/lion-3318081__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/14/00/46/lion-3318081__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/03/23/08/52/lion-3253084__340.jpg 1x, https://cdn.pixabay.com/photo/2018/03/23/08/52/lion-3253084__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/03/23/08/52/lion-3253084__340.jpg', 'alt': 'Lion, Cat, Predator, Big Cat', 'title': 'Lion, Cat, Predator, Big Cat'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/01/21/09/47/lion-3096191__340.jpg 1x, https://cdn.pixabay.com/photo/2018/01/21/09/47/lion-3096191__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/01/21/09/47/lion-3096191__340.jpg', 'alt': 'Lion, Cat, Predator, Big Cat', 'title': 'Lion, Cat, Predator, Big Cat'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/11/19/33/lion-3311536__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/11/19/33/lion-3311536__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/11/19/33/lion-3311536__340.jpg', 'alt': 'Lion, Predator, Sleep, Cozy, Rest', 'title': 'Lion, Predator, Sleep, Cozy, Rest'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2016/04/03/22/41/lion-1305797__340.jpg 1x, https://cdn.pixabay.com/photo/2016/04/03/22/41/lion-1305797__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2016/04/03/22/41/lion-1305797__340.jpg', 'alt': 'Lion Etosha Namibia Africa Safari Lion Cub', 'title': 'Lion Etosha Namibia Africa Safari Lio'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/14/21/00/seal-3320110__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/21/00/seal-3320110__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/14/21/00/seal-3320110__340.jpg', 'alt': 'Seal, Sea Lion, Water, Robbe', 'title': 'Seal, Sea Lion, Water, Robbe'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2017/12/30/11/54/lion-3049884__340.jpg 1x, https://cdn.pixabay.com/photo/2017/12/30/11/54/lion-3049884__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2017/12/30/11/54/lion-3049884__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/26/19/24/tiger-3352857__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/26/19/24/tiger-3352857__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/26/19/24/tiger-3352857__340.jpg', 'alt': 'Tiger, Predator, Animal World, Mammal', 'title': 'Tiger, Predator, Animal World'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/11/21/48/seal-3311891__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/11/21/48/seal-3311891__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/11/21/48/seal-3311891__340.jpg', 'alt': 'Seal, Sea Lion, Water, Robbe', 'title': 'Seal, Sea Lion, Water, Robbe'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/14/17/23/lion-3319487__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/17/23/lion-3319487__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/14/17/23/lion-3319487__340.jpg', 'alt': 'Lion, Zoo, Feline, Wild, Tawny', 'title': 'Lion, Zoo, Feline, Wild, Tawny'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/23/16/52/seal-3344872__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/23/16/52/seal-3344872__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/23/16/52/seal-3344872__340.jpg', 'alt': 'Seal, Sea Lion, Water, Robbe', 'title': 'Seal, Sea Lion, Water, Robbe'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/01/09/18/06/lion-3072184__340.jpg 1x, https://cdn.pixabay.com/photo/2018/01/09/18/06/lion-3072184__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/01/09/18/06/lion-3072184__340.jpg', 'alt': 'Lion, Cat, Predator, Big Cat', 'title': 'Lion, Cat, Predator, Big Cat'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2014/11/03/11/10/lion-515030__340.jpg 1x, https://cdn.pixabay.com/photo/2014/11/03/11/10/lion-515030__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2014/11/03/11/10/lion-515030__340.jpg', 'alt': 'Lion Wildcat Safari Africa Animal World Wi', 'title': 'Lion Wildcat Safari Africa Animal Wor'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2015/04/14/08/52/lion-721836__340.jpg 1x, https://cdn.pixabay.com/photo/2015/04/14/08/52/lion-721836__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2015/04/14/08/52/lion-721836__340.jpg', 'alt': 'Lion Panthera Leo Lioness Animal World Afr', 'title': 'Lion Panthera Leo Lioness Animal Worl'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/03/30/22/09/lion-3276692__340.jpg 1x, https://cdn.pixabay.com/photo/2018/03/30/22/09/lion-3276692__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/03/30/22/09/lion-3276692__340.jpg', 'alt': 'Lion, Savannah, Nature, Predator, Dusk', 'title': 'Lion, Savannah, Nature, Predator'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/30/17/39/sea-lion-3363402__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/30/17/39/sea-lion-3363402__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/30/17/39/sea-lion-3363402__340.jpg', 'alt': 'Sea Lion, Feeding, Sea Animal', 'title': 'Sea Lion, Feeding, Sea Animal'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/06/23/18/lion-3297303__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/06/23/18/lion-3297303__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/06/23/18/lion-3297303__340.jpg', 'alt': 'Lion, Animal, Pets, Vintage Lion', 'title': 'Lion, Animal, Pets, Vintage Lion'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/09/19/03/lion-3305122__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/09/19/03/lion-3305122__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/09/19/03/lion-3305122__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/19/21/17/lion-3334357__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/19/21/17/lion-3334357__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/19/21/17/lion-3334357__340.jpg', 'alt': 'Lion, Cute, Sketch, Funny', 'title': 'Lion, Cute, Sketch, Funny'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2017/10/25/21/05/white-lion-2889308__340.jpg 1x, https://cdn.pixabay.com/photo/2017/10/25/21/05/white-lion-2889308__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2017/10/25/21/05/white-lion-2889308__340.jpg', 'alt': 'White Lion, Eyes, Lion, Shadows', 'title': 'White Lion, Eyes, Lion, Shadows'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/14/20/46/seal-3320055__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/20/46/seal-3320055__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/14/20/46/seal-3320055__340.jpg', 'alt': 'Seal, Sea Lion, Water, Robbe', 'title': 'Seal, Sea Lion, Water, Robbe'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/14/00/47/lion-3318085__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/00/47/lion-3318085__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/14/00/47/lion-3318085__340.jpg', 'alt': 'Lion, Predator, Dangerous, Mane, Cat', 'title': 'Lion, Predator, Dangerous, Mane'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2014/12/11/13/31/cat-564202__340.jpg 1x, https://cdn.pixabay.com/photo/2014/12/11/13/31/cat-564202__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2014/12/11/13/31/cat-564202__340.jpg', 'alt': 'Cat Lion Shadow Carnivore Big Leo Nature M', 'title': 'Cat Lion Shadow Carnivore Big Leo Nat'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/02/03/20/23/mammal-3128440__340.jpg 1x, https://cdn.pixabay.com/photo/2018/02/03/20/23/mammal-3128440__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/02/03/20/23/mammal-3128440__340.jpg', 'alt': 'Mammal, Animal, Nature, Animal World', 'title': 'Mammal, Animal, Nature'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2014/05/11/10/26/lion-341717__340.jpg 1x, https://cdn.pixabay.com/photo/2014/05/11/10/26/lion-341717__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2014/05/11/10/26/lion-341717__340.jpg', 'alt': 'Lion Panthera Leo Lioness Animal World Afr', 'title': 'Lion Panthera Leo Lioness Animal Worl'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/14/20/48/seal-3320065__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/20/48/seal-3320065__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/14/20/48/seal-3320065__340.jpg', 'alt': 'Seal, Sea Lion, Water, Robbe', 'title': 'Seal, Sea Lion, Water, Robbe'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2016/07/27/10/41/lion-1544990__340.jpg 1x, https://cdn.pixabay.com/photo/2016/07/27/10/41/lion-1544990__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2016/07/27/10/41/lion-1544990__340.jpg', 'alt': 'Lion Lion Cub Cat Big Cat Animal Africa Wi', 'title': 'Lion Lion Cub Cat Big Cat Animal Afri'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/25/10/40/wild-world-3349200__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/25/10/40/wild-world-3349200__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/25/10/40/wild-world-3349200__340.jpg', 'alt': 'Wild World, Lion, Nature, Fur, Cat', 'title': 'Wild World, Lion, Nature, Fur, Cat'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/27/23/08/goal-3356125__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/27/23/08/goal-3356125__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/27/23/08/goal-3356125__340.jpg', 'alt': 'Goal, Portal, Door, Input, Gate', 'title': 'Goal, Portal, Door, Input, Gate'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/21/22/20/cat-3339712__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/21/22/20/cat-3339712__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/21/22/20/cat-3339712__340.jpg', 'alt': 'Cat, Lion, Wildlife, Mammal, Carnivore', 'title': 'Cat, Lion, Wildlife, Mammal'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/03/21/19/45/mammals-3247970__340.jpg 1x, https://cdn.pixabay.com/photo/2018/03/21/19/45/mammals-3247970__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/03/21/19/45/mammals-3247970__340.jpg', 'alt': 'Mammals, Portrait, Cat, Nature, Lion', 'title': 'Mammals, Portrait, Cat, Nature'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2014/11/03/11/10/lion-515029__340.jpg 1x, https://cdn.pixabay.com/photo/2014/11/03/11/10/lion-515029__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2014/11/03/11/10/lion-515029__340.jpg', 'alt': 'Lion Predator Big Cat Safari Africa Animal', 'title': 'Lion Predator Big Cat Safari Africa A'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/26/00/19/nature-3350998__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/26/00/19/nature-3350998__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/26/00/19/nature-3350998__340.jpg', 'alt': 'Nature, Animal, Animal World, Lion', 'title': 'Nature, Animal, Animal World, Lion'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/14/21/08/seal-3320143__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/14/21/08/seal-3320143__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/14/21/08/seal-3320143__340.jpg', 'alt': 'Seal, Sea Lion, Water, Robbe', 'title': 'Seal, Sea Lion, Water, Robbe'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/30/09/44/cat-3362252__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/30/09/44/cat-3362252__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/30/09/44/cat-3362252__340.jpg', 'alt': 'Cat, Lion, Mammal, Wildlife, Carnivore', 'title': 'Cat, Lion, Mammal, Wildlife'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/30/16/44/sculpture-3363214__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/30/16/44/sculpture-3363214__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/30/16/44/sculpture-3363214__340.jpg', 'alt': 'Sculpture, Lion, Bronze, Pride, Animal', 'title': 'Sculpture, Lion, Bronze, Pride'}\n",
"{'src': '/static/img/blank.gif', 'data-lazy-srcset': 'https://cdn.pixabay.com/photo/2018/04/11/20/35/seal-3311713__340.jpg 1x, https://cdn.pixabay.com/photo/2018/04/11/20/35/seal-3311713__480.jpg 2x', 'data-lazy': 'https://cdn.pixabay.com/photo/2018/04/11/20/35/seal-3311713__340.jpg', 'alt': 'Seal, Sea Lion, Sleep, Water, Robbe', 'title': 'Seal, Sea Lion, Sleep, Water, Robbe'}\n"
]
}
],
"source": [
"import requests, urllib, os\n",
"from bs4 import BeautifulSoup as bs\n",
"\n",
"def download_image(img_src, filename):\n",
" res = urllib.request.urlretrieve(img_src, filename)\n",
" return res\n",
"\n",
"def crawl_image(name):\n",
" res = requests.get(\"https://pixabay.com/en/photos/?q=\"+name)\n",
" # res = requests.get(f'https://pixabay.com/en/photos/?q={name}')\n",
" if not os.path.isdir(name):\n",
" os.mkdir(name)\n",
" if res.status_code == 200:\n",
" soup = bs(res.text, 'html5lib')\n",
" images = soup.select('#content > div > div > div > div > div > a > img')\n",
" print(images)\n",
" for image in images:\n",
" print(image.attrs)\n",
" image_url = image.attrs['src']\n",
" filename = image_url.split('/')[-1]\n",
" if(filename == \"blank.gif\"):\n",
" continue\n",
" print(image_url, filename)\n",
" download_image(image_url, name+\"/\"+filename)\n",
"\n",
"crawl_image(\"lion\")"
]
},
{
"cell_type": "code",
"execution_count": 153,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"http://www.imdb.com/movies-coming-soon/2015-01 crawling..\n",
"http://www.imdb.com/movies-coming-soon/2015-02 crawling..\n",
"[['The Woman in Black 2: Angel of Death (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTgxMjUyNTAxNF5BMl5BanBnXkFtZTgwNTk4MDUyMzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '98 min',\n",
" ''],\n",
" ['A Most Violent Year (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjE4OTY4ODg3Ml5BMl5BanBnXkFtZTgwMTI1MTg1MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '125 min',\n",
" ''],\n",
" ['Leviafan (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjAwMTY3MTU0Ml5BMl5BanBnXkFtZTgwNzE0ODAwMzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '140 min',\n",
" ''],\n",
" ['[REC] 4: Apocalipsis (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BOTU3OTU2ODc5MF5BMl5BanBnXkFtZTgwNjY3MDY2MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '95 min',\n",
" ''],\n",
" ['The Search for General Tso (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BODc5MzA4OTUxOF5BMl5BanBnXkFtZTgwNDA4ODI2MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '71 min',\n",
" ''],\n",
" ['Taken 3 (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BNjM5MDU3NTY0M15BMl5BanBnXkFtZTgwOTk2ODU2MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '108 min',\n",
" ''],\n",
" ['Die geliebten Schwestern (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTY2MjMxNDQ0MF5BMl5BanBnXkFtZTgwNzg3ODI2MzE@._V1._SY296_CR0,0,200,296_UY209_CR0,0,140,209_AL_.jpg',\n",
" '138 min',\n",
" ''],\n",
" ['Boven is het stil (2013)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTM4MDQ4Mzg4N15BMl5BanBnXkFtZTcwNzE3NTU3OQ@@._V1_UY209_CR3,0,140,209_AL_.jpg',\n",
" '93 min',\n",
" ''],\n",
" ['Paddington (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTAxOTMwOTkwNDZeQTJeQWpwZ15BbWU4MDEyMTI1NjMx._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '95 min',\n",
" ''],\n",
" ['The Wedding Ringer (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTk3MjQyNTUxNl5BMl5BanBnXkFtZTgwNjM3Mjk1MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '101 min',\n",
" ''],\n",
" ['Blackhat (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTg1NDUyMzk5NV5BMl5BanBnXkFtZTgwOTk1NzUxMzE@._V1_UX140_CR0,0,140,209_AL_.jpg',\n",
" '133 min',\n",
" ''],\n",
" ['Still Alice (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjIzNzAxNjY1Nl5BMl5BanBnXkFtZTgwMDg4ODQxMzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '101 min',\n",
" ''],\n",
" ['Spare Parts (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTc5NzI4NTIyMF5BMl5BanBnXkFtZTgwMzIzNDMxMzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '114 min',\n",
" ''],\n",
" ['Match (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BOTA5NzAxNzMxNV5BMl5BanBnXkFtZTgwNzY2NDE3MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '92 min',\n",
" ''],\n",
" ['Little Accidents (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BNTQzMmRjMTktZGQ0NC00MjY5LWI2NTAtMDI2NzczZTcxYWE3XkEyXkFqcGdeQXVyNDA1NDA2NTk@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '105 min',\n",
" ''],\n",
" ['Son of a Gun (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMDE1MTIzNzEtNmU0MC00Y2UzLWE4NTgtYmY1YzJlNTFjYWNkL2ltYWdlXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_UY209_CR3,0,140,209_AL_.jpg',\n",
" '102 min',\n",
" ''],\n",
" ['The Boy Next Door (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTgxNTEyMTYzOV5BMl5BanBnXkFtZTgwNzQ4OTg5MjE@._V1_UX140_CR0,0,140,209_AL_.jpg',\n",
" '91 min',\n",
" ''],\n",
" ['Mortdecai (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjM3NDcxOTM5Ml5BMl5BanBnXkFtZTgwNTEwNzE0MzE@._V1_UX140_CR0,0,140,209_AL_.jpg',\n",
" '107 min',\n",
" ''],\n",
" ['Black Sea (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjMyNzI1ODA3OF5BMl5BanBnXkFtZTgwMTI5OTczMzE@._V1._CR54,54,1274,1940_UX140_CR0,0,140,209_AL_.jpg',\n",
" '114 min',\n",
" ''],\n",
" ['Strange Magic (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjA0NjU3MTU5OF5BMl5BanBnXkFtZTgwMTYyMDQ3MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '99 min',\n",
" ''],\n",
" ['Cake (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMmE2ZTQ5NTUtMzM2NS00YTIxLWEyMDQtMjBiMGNmODgwN2U5XkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '102 min',\n",
" ''],\n",
" ['Song One (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjM4NDM5NDI1OV5BMl5BanBnXkFtZTgwMDQ4NjE0MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '86 min',\n",
" ''],\n",
" ['Mommy (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjE3NjMwMjc3N15BMl5BanBnXkFtZTgwNDk4MjA0MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '139 min',\n",
" ''],\n",
" ['Red Army (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjIxMDYwMTg3M15BMl5BanBnXkFtZTgwMDQ1NzQ0MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '84 min',\n",
" ''],\n",
" ['The Duke of Burgundy (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjE3MDY2NTQ5Nl5BMl5BanBnXkFtZTgwMDIxMDI5MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '104 min',\n",
" ''],\n",
" ['Black or White (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTYyMzE2NTE5MV5BMl5BanBnXkFtZTgwNDI3ODI2MzE@._V1_UX140_CR0,0,140,209_AL_.jpg',\n",
" '121 min',\n",
" ''],\n",
" ['Project Almanac (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTUxMjQ2NjI4OV5BMl5BanBnXkFtZTgwODc2NjUwNDE@._V1_UX140_CR0,0,140,209_AL_.jpg',\n",
" '106 min',\n",
" ''],\n",
" ['The Loft (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjAyNTM4ODM5NV5BMl5BanBnXkFtZTgwNTA4NDE3MzE@._V1_UX140_CR0,0,140,209_AL_.jpg',\n",
" '108 min',\n",
" ''],\n",
" ['Wild Card (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjAyNjkyOTgzNF5BMl5BanBnXkFtZTgwMTk0MDc2MzE@._V1_UX140_CR0,0,140,209_AL_.jpg',\n",
" '92 min',\n",
" ''],\n",
" ['Amira & Sam (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjM5MTE1MDY0Nl5BMl5BanBnXkFtZTgwOTE3NTY4MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '90 min',\n",
" ''],\n",
" ['Timbuktu (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjMwOTQ0NTUyMF5BMl5BanBnXkFtZTgwNDg3NDUxNDE@._V1_UY209_CR2,0,140,209_AL_.jpg',\n",
" '97 min',\n",
" ''],\n",
" ['Bande de filles (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjA5MDM1ODE5NV5BMl5BanBnXkFtZTgwNjg0MTk5MzE@._V1_UY209_CR1,0,140,209_AL_.jpg',\n",
" '113 min',\n",
" ''],\n",
" ['Jupiter Ascending (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTQyNzk2MjA2NF5BMl5BanBnXkFtZTgwMjEwNzk3MjE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '127 min',\n",
" ''],\n",
" ['Seventh Son (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjAxNTg2MDkyN15BMl5BanBnXkFtZTgwNzA3NzY1MjE@._V1_UX140_CR0,0,140,209_AL_.jpg',\n",
" '102 min',\n",
" ''],\n",
" ['The SpongeBob Movie: Sponge Out of Water (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjYyNDczNTE0MF5BMl5BanBnXkFtZTgwNjkzNDYxMzE@._V1_UX140_CR0,0,140,209_AL_.jpg',\n",
" '92 min',\n",
" ''],\n",
" ['Ballet 422 (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTUxMjk2MDM2NF5BMl5BanBnXkFtZTgwOTMzOTUzMzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '75 min',\n",
" ''],\n",
" ['Fifty Shades of Grey (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjE1MTM4NDAzOF5BMl5BanBnXkFtZTgwNTMwNjI0MzE@._V1_UX140_CR0,0,140,209_AL_.jpg',\n",
" '125 min',\n",
" ''],\n",
" ['Kingsman: Secret Agent (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTkxMjgwMDM4Ml5BMl5BanBnXkFtZTgwMTk3NTIwNDE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '129 min',\n",
" ''],\n",
" ['The Last Five Years (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTA2MTMwMjIxMTdeQTJeQWpwZ15BbWU4MDAwMTYxNzMx._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '94 min',\n",
" ''],\n",
" ['What We Do in the Shadows (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjAwNDA5NzEwM15BMl5BanBnXkFtZTgwMTA1MDUyNDE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '86 min',\n",
" ''],\n",
" ['Old Fashioned (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjcxNzk4ODM3Nl5BMl5BanBnXkFtZTgwODA4OTI5MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '115 min',\n",
" ''],\n",
" ['Hot Tub Time Machine 2 (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTU3NzQzMzE0NV5BMl5BanBnXkFtZTgwMDM4MTI0NDE@._V1_UX140_CR0,0,140,209_AL_.jpg',\n",
" '93 min',\n",
" ''],\n",
" ['The DUFF (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTc3OTg3MDUwN15BMl5BanBnXkFtZTgwMTAwMTkxNDE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '101 min',\n",
" ''],\n",
" ['McFarland, USA (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjMwNjY2Mjk5OV5BMl5BanBnXkFtZTgwODM2NTA0MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '129 min',\n",
" ''],\n",
" ['Waildeu Teiljeu: Cham-eul Su Eobsneun Sungan (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BNzAzMjA1ODAxOV5BMl5BanBnXkFtZTgwODg4NTQzNDE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '122 min',\n",
" ''],\n",
" ['Gloria (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BNzE0NDAyNzk5NF5BMl5BanBnXkFtZTgwMzA3OTcyNjE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '126 min',\n",
" ''],\n",
" ['Focus (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTUwODg2OTA4OF5BMl5BanBnXkFtZTgwOTE5MTE4MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '105 min',\n",
" ''],\n",
" ['The Lazarus Effect (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjM2ODM1OTA0M15BMl5BanBnXkFtZTgwMDMxMDI5MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '83 min',\n",
" ''],\n",
" ['Maps to the Stars (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTY3MjQwNzYyNV5BMl5BanBnXkFtZTgwNTY3NDQ5MzE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '111 min',\n",
" ''],\n",
" ['71: Tears of Belfast (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTg1NjE5Njg4M15BMl5BanBnXkFtZTgwMzEyODAzNDE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '99 min',\n",
" ''],\n",
" ['The Hunting Ground (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BNjc4Mjk3ODgxMl5BMl5BanBnXkFtZTgwMjc3OTQ1NDE@._V1_UY209_CR3,0,140,209_AL_.jpg',\n",
" '103 min',\n",
" ''],\n",
" ['A la mala (2015)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BNjEzODA5OTU3Nl5BMl5BanBnXkFtZTgwMzcyODAxNDE@._V1_UY209_CR0,0,140,209_AL_.jpg',\n",
" '99 min',\n",
" ''],\n",
" ['Everly (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjEyNTU4NTE5NV5BMl5BanBnXkFtZTgwNzY4NzIxNDE@._V1_UX140_CR0,0,140,209_AL_.jpg',\n",
" '92 min',\n",
" ''],\n",
" ['The Salvation (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMTA5MTU2NjIxOTNeQTJeQWpwZ15BbWU4MDA5Njc0MDIx._V1_UY209_CR1,0,140,209_AL_.jpg',\n",
" '92 min',\n",
" ''],\n",
" ['My Life Directed by Nicolas Winding Refn (2014)',\n",
" 'https://ia.media-imdb.com/images/M/MV5BMjEwNDg1ODQ2Nl5BMl5BanBnXkFtZTgwOTU1NzM3MjE@._V1_UY209_CR1,0,140,209_AL_.jpg',\n",
" '58 min',\n",
" '']]\n"
]
}
],
"source": [
"def movie_crawler(url):\n",
" res = requests.get(url)\n",
" if res.status_code == 200:\n",
" soup = bs(res.text, \"html5lib\")\n",
" movies = soup.select('#main > div > div.list.detail > div')\n",
" movies = soup.findAll('div', {'itemtype': 'http://schema.org/Movie'})\n",
" table = []\n",
" for movie in movies:\n",
" row = []\n",
" \n",
" title = movie.findAll('h4', {'itemprop': 'name'})\n",
" image = movie.findAll('img', {'itemprop': 'image'})\n",
" running_time = movie.findAll('time', {'itemprop': 'duration'})\n",
" score = movie.select('div.rating_txt > div > strong')\n",
" \n",
" row.append(title[0].text.strip() if len(title)>0 else \"\")\n",
" row.append(image[0]['src'].strip() if len(image)>0 else \"\")\n",
" row.append(running_time[0].text.strip() if len(running_time)>0 else \"\")\n",
" row.append(score[0].text.strip() if len(score)>0 else \"\")\n",
" \n",
" table.append(row)\n",
" \n",
" return table\n",
" \n",
"jan_2015 = movie_crawler('http://www.imdb.com/movies-coming-soon/2015-01')\n",
"target_url = 'http://www.imdb.com/movies-coming-soon/{0}'\n",
"movie_total = []\n",
"for i in range(1,3):\n",
" date = \"2015-\" + str(i).zfill(2)\n",
" print(target_url.format(date)+\" crawling..\")\n",
" movie_total += movie_crawler(target_url.format(date))\n",
"\n",
"from pprint import pprint\n",
"pprint(movie_total)"
]
},
{
"cell_type": "code",
"execution_count": 170,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Found \"this\"\n",
" in \"Does this text match the pattern?\"\n",
"from 5 to 9 (\"this\")\n"
]
}
],
"source": [
"import re\n",
"\n",
"pattern = 'this'\n",
"text = \"Does this text match the pattern?\"\n",
"\n",
"match = re.search(pattern, text)\n",
"\n",
"s = match.start()\n",
"e = match.end()\n",
"\n",
"print('Found \"%s\"\\n in \"%s\"\\nfrom %d to %d (\"%s\")' % \\\n",
" (match.re.pattern, match.string, s, e, text[s:e]))"
]
},
{
"cell_type": "code",
"execution_count": 169,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Text: 'Does this text match the pattern?'\n",
"\n",
"Seeking \"this\" -> match!\n",
"Seeking \"that\" -> no match\n"
]
}
],
"source": [
"import re\n",
"regexes = [re.compile(p)\n",
" for p in ['this', 'that']\n",
" ]\n",
"text = \"Does this text match the pattern?\"\n",
"\n",
"print('Text: %r\\n' % text)\n",
"\n",
"for regex in regexes:\n",
" print('Seeking \"%s\" -> ' % regex.pattern, end=\"\")\n",
" if regex.search(text):\n",
" print('match!')\n",
" else:\n",
" print('no match')\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 174,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"aaaaaaaaaa\n"
]
}
],
"source": [
"print(\"a\"*10)"
]
},
{
"cell_type": "code",
"execution_count": 187,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[\"Hello, it's me.\",\n",
" \"I was wodering if after all these years, you'd like to meet, to go over everything.\",\n",
" \"They say that time's supposed to heal ya.\"]"
]
},
"execution_count": 187,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import nltk\n",
"txt = \"Hello, it's me. I was wodering \\\n",
"if after all these years, you'd like to meet, \\\n",
"to go over everything. They \\\n",
"say that time's supposed to heal ya.\"\n",
"txt\n",
"sentences = nltk.tokenize.sent_tokenize(txt)\n",
"sentences"
]
},
{
"cell_type": "code",
"execution_count": 176,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[nltk_data] Downloading package punkt to\n",
"[nltk_data] C:\\Users\\fyj\\AppData\\Roaming\\nltk_data...\n",
"[nltk_data] Unzipping tokenizers\\punkt.zip.\n"
]
},
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 176,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nltk.download('punkt')"
]
},
{
"cell_type": "code",
"execution_count": 188,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[['Hello', ',', 'it', \"'s\", 'me', '.'],\n",
" ['I',\n",
" 'was',\n",
" 'wodering',\n",
" 'if',\n",
" 'after',\n",
" 'all',\n",
" 'these',\n",
" 'years',\n",
" ',',\n",
" 'you',\n",
" \"'d\",\n",
" 'like',\n",
" 'to',\n",
" 'meet',\n",
" ',',\n",
" 'to',\n",
" 'go',\n",
" 'over',\n",
" 'everything',\n",
" '.'],\n",
" ['They', 'say', 'that', 'time', \"'s\", 'supposed', 'to', 'heal', 'ya', '.']]"
]
},
"execution_count": 188,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import nltk\n",
"txt = \"Hello, it's me. I was wodering \\\n",
"if after all these years, you'd like to meet, \\\n",
"to go over everything. They \\\n",
"say that time's supposed to heal ya.\"\n",
"txt\n",
"words = [nltk.tokenize.word_tokenize(sen) for sen in sentences]\n",
"words"
]
},
{
"cell_type": "code",
"execution_count": 184,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[[('Hello', 'NNP'),\n",
" (',', ','),\n",
" ('it', 'PRP'),\n",
" (\"'s\", 'VBZ'),\n",
" ('me', 'PRP'),\n",
" ('.', '.')],\n",
" [('I', 'PRP'),\n",
" ('was', 'VBD'),\n",
" ('wodering', 'VBG'),\n",
" ('if', 'IN'),\n",
" ('after', 'IN'),\n",
" ('all', 'PDT'),\n",
" ('these', 'DT'),\n",
" ('years', 'NNS'),\n",
" ('.', '.')],\n",
" [('You', 'PRP'),\n",
" (\"'d\", 'MD'),\n",
" ('like', 'VB'),\n",
" ('to', 'TO'),\n",
" ('meet', 'VB'),\n",
" (',', ','),\n",
" ('to', 'TO'),\n",
" ('go', 'VB'),\n",
" ('over', 'RP'),\n",
" ('everything', 'NN'),\n",
" ('.', '.')],\n",
" [('They', 'PRP'),\n",
" ('say', 'VBP'),\n",
" ('that', 'IN'),\n",
" ('time', 'NN'),\n",
" (\"'s\", 'POS'),\n",
" ('supposed', 'VBN'),\n",
" ('to', 'TO'),\n",
" ('heal', 'VB'),\n",
" ('ya', 'NN'),\n",
" ('.', '.')]]"
]
},
"execution_count": 184,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pos_tagged_tokens = [nltk.pos_tag(t) for t in words]\n",
"pos_tagged_tokens"
]
},
{
"cell_type": "code",
"execution_count": 183,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[nltk_data] Downloading package averaged_perceptron_tagger to\n",
"[nltk_data] C:\\Users\\fyj\\AppData\\Roaming\\nltk_data...\n",
"[nltk_data] Unzipping taggers\\averaged_perceptron_tagger.zip.\n"
]
},
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 183,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nltk.download('averaged_perceptron_tagger')"
]
},
{
"cell_type": "code",
"execution_count": 190,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"str"
]
},
"execution_count": 190,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from urllib.request import urlopen\n",
"url = \"http://www.gutenberg.org/files/2554/2554-0.txt\"\n",
"raw = urlopen(url).read().decode()\n",
"type(raw)"
]
},
{
"cell_type": "code",
"execution_count": 191,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1176965"
]
},
"execution_count": 191,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(raw)"
]
},
{
"cell_type": "code",
"execution_count": 195,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The Project Gutenberg EBook of Crime and Punishment, by Fyodor Dostoevsky\r\n"
]
}
],
"source": [
"print(raw[:75])"
]
},
{
"cell_type": "code",
"execution_count": 196,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"257726"
]
},
"execution_count": 196,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import nltk\n",
"tokens = nltk.word_tokenize(raw)\n",
"len(tokens)"
]
},
{
"cell_type": "code",
"execution_count": 197,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['\\ufeffThe',\n",
" 'Project',\n",
" 'Gutenberg',\n",
" 'EBook',\n",
" 'of',\n",
" 'Crime',\n",
" 'and',\n",
" 'Punishment',\n",
" ',',\n",
" 'by']"
]
},
"execution_count": 197,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tokens[:10]"
]
},
{
"cell_type": "code",
"execution_count": 216,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'The Project Gutenberg EBook of Crime and Punishment, by Fyodor Dostoevsky\\r\\n'"
]
},
"execution_count": 216,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"raw_new = raw.replace('\\ufeff', '')\n",
"raw_new[:75]"
]
},
{
"cell_type": "code",
"execution_count": 220,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'The Project Gutenberg EBook of Crime and Punishment, by Fyodor Dostoevsky '"
]
},
"execution_count": 220,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"raw_new = raw_new.replace('\\r\\n', ' ')\n",
"raw_new[:75]"
]
},
{
"cell_type": "code",
"execution_count": 223,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18])"
]
},
"execution_count": 223,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import numpy as np\n",
"i = list(range(10))\n",
"n = np.array(i)\n",
"n *= 2\n",
"n"
]
},
{
"cell_type": "code",
"execution_count": 224,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>0</th>\n",
" <th>1</th>\n",
" <th>2</th>\n",
" <th>3</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>The Woman in Black 2: Angel of Death (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTgxMjU...</td>\n",
" <td>98 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>A Most Violent Year (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjE4OTY...</td>\n",
" <td>125 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Leviafan (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjAwMTY...</td>\n",
" <td>140 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>[REC] 4: Apocalipsis (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BOTU3OTU...</td>\n",
" <td>95 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>The Search for General Tso (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BODc5MzA...</td>\n",
" <td>71 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Taken 3 (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BNjM5MDU...</td>\n",
" <td>108 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>Die geliebten Schwestern (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTY2MjM...</td>\n",
" <td>138 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>Boven is het stil (2013)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTM4MDQ...</td>\n",
" <td>93 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>Paddington (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTAxOTM...</td>\n",
" <td>95 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>The Wedding Ringer (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTk3MjQ...</td>\n",
" <td>101 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>Blackhat (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTg1NDU...</td>\n",
" <td>133 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>Still Alice (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjIzNzA...</td>\n",
" <td>101 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>Spare Parts (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTc5NzI...</td>\n",
" <td>114 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>Match (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BOTA5NzA...</td>\n",
" <td>92 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>Little Accidents (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BNTQzMmR...</td>\n",
" <td>105 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>Son of a Gun (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMDE1MTI...</td>\n",
" <td>102 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>The Boy Next Door (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTgxNTE...</td>\n",
" <td>91 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>Mortdecai (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjM3NDc...</td>\n",
" <td>107 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>Black Sea (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjMyNzI...</td>\n",
" <td>114 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>Strange Magic (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjA0NjU...</td>\n",
" <td>99 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>Cake (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMmE2ZTQ...</td>\n",
" <td>102 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>Song One (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjM4NDM...</td>\n",
" <td>86 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>Mommy (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjE3NjM...</td>\n",
" <td>139 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>Red Army (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjIxMDY...</td>\n",
" <td>84 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>The Duke of Burgundy (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjE3MDY...</td>\n",
" <td>104 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>Black or White (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTYyMzE...</td>\n",
" <td>121 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>Project Almanac (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTUxMjQ...</td>\n",
" <td>106 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>The Loft (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjAyNTM...</td>\n",
" <td>108 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>Wild Card (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjAyNjk...</td>\n",
" <td>92 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>Amira &amp; Sam (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjM5MTE...</td>\n",
" <td>90 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>30</th>\n",
" <td>Timbuktu (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjMwOTQ...</td>\n",
" <td>97 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>31</th>\n",
" <td>Bande de filles (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjA5MDM...</td>\n",
" <td>113 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>32</th>\n",
" <td>Jupiter Ascending (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTQyNzk...</td>\n",
" <td>127 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>33</th>\n",
" <td>Seventh Son (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjAxNTg...</td>\n",
" <td>102 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>34</th>\n",
" <td>The SpongeBob Movie: Sponge Out of Water (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjYyNDc...</td>\n",
" <td>92 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>35</th>\n",
" <td>Ballet 422 (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTUxMjk...</td>\n",
" <td>75 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>36</th>\n",
" <td>Fifty Shades of Grey (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjE1MTM...</td>\n",
" <td>125 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>37</th>\n",
" <td>Kingsman: Secret Agent (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTkxMjg...</td>\n",
" <td>129 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>38</th>\n",
" <td>The Last Five Years (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTA2MTM...</td>\n",
" <td>94 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>39</th>\n",
" <td>What We Do in the Shadows (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjAwNDA...</td>\n",
" <td>86 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>40</th>\n",
" <td>Old Fashioned (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjcxNzk...</td>\n",
" <td>115 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>41</th>\n",
" <td>Hot Tub Time Machine 2 (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTU3NzQ...</td>\n",
" <td>93 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>42</th>\n",
" <td>The DUFF (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTc3OTg...</td>\n",
" <td>101 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>43</th>\n",
" <td>McFarland, USA (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjMwNjY...</td>\n",
" <td>129 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>44</th>\n",
" <td>Waildeu Teiljeu: Cham-eul Su Eobsneun Sungan (...</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BNzAzMjA...</td>\n",
" <td>122 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>45</th>\n",
" <td>Gloria (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BNzE0NDA...</td>\n",
" <td>126 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>46</th>\n",
" <td>Focus (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTUwODg...</td>\n",
" <td>105 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>47</th>\n",
" <td>The Lazarus Effect (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjM2ODM...</td>\n",
" <td>83 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>48</th>\n",
" <td>Maps to the Stars (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTY3MjQ...</td>\n",
" <td>111 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>49</th>\n",
" <td>71: Tears of Belfast (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTg1NjE...</td>\n",
" <td>99 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>50</th>\n",
" <td>The Hunting Ground (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BNjc4Mjk...</td>\n",
" <td>103 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>51</th>\n",
" <td>A la mala (2015)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BNjEzODA...</td>\n",
" <td>99 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>52</th>\n",
" <td>Everly (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjEyNTU...</td>\n",
" <td>92 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>53</th>\n",
" <td>The Salvation (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMTA5MTU...</td>\n",
" <td>92 min</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>54</th>\n",
" <td>My Life Directed by Nicolas Winding Refn (2014)</td>\n",
" <td>https://ia.media-imdb.com/images/M/MV5BMjEwNDg...</td>\n",
" <td>58 min</td>\n",
" <td></td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 0 \\\n",
"0 The Woman in Black 2: Angel of Death (2014) \n",
"1 A Most Violent Year (2014) \n",
"2 Leviafan (2014) \n",
"3 [REC] 4: Apocalipsis (2014) \n",
"4 The Search for General Tso (2014) \n",
"5 Taken 3 (2014) \n",
"6 Die geliebten Schwestern (2014) \n",
"7 Boven is het stil (2013) \n",
"8 Paddington (2014) \n",
"9 The Wedding Ringer (2015) \n",
"10 Blackhat (2015) \n",
"11 Still Alice (2014) \n",
"12 Spare Parts (2015) \n",
"13 Match (2014) \n",
"14 Little Accidents (2014) \n",
"15 Son of a Gun (2014) \n",
"16 The Boy Next Door (2015) \n",
"17 Mortdecai (2015) \n",
"18 Black Sea (2014) \n",
"19 Strange Magic (2015) \n",
"20 Cake (2014) \n",
"21 Song One (2014) \n",
"22 Mommy (2014) \n",
"23 Red Army (2014) \n",
"24 The Duke of Burgundy (2014) \n",
"25 Black or White (2014) \n",
"26 Project Almanac (2015) \n",
"27 The Loft (2014) \n",
"28 Wild Card (2015) \n",
"29 Amira & Sam (2014) \n",
"30 Timbuktu (2014) \n",
"31 Bande de filles (2014) \n",
"32 Jupiter Ascending (2015) \n",
"33 Seventh Son (2014) \n",
"34 The SpongeBob Movie: Sponge Out of Water (2015) \n",
"35 Ballet 422 (2014) \n",
"36 Fifty Shades of Grey (2015) \n",
"37 Kingsman: Secret Agent (2014) \n",
"38 The Last Five Years (2014) \n",
"39 What We Do in the Shadows (2014) \n",
"40 Old Fashioned (2014) \n",
"41 Hot Tub Time Machine 2 (2015) \n",
"42 The DUFF (2015) \n",
"43 McFarland, USA (2015) \n",
"44 Waildeu Teiljeu: Cham-eul Su Eobsneun Sungan (... \n",
"45 Gloria (2014) \n",
"46 Focus (2015) \n",
"47 The Lazarus Effect (2015) \n",
"48 Maps to the Stars (2014) \n",
"49 71: Tears of Belfast (2014) \n",
"50 The Hunting Ground (2015) \n",
"51 A la mala (2015) \n",
"52 Everly (2014) \n",
"53 The Salvation (2014) \n",
"54 My Life Directed by Nicolas Winding Refn (2014) \n",
"\n",
" 1 2 3 \n",
"0 https://ia.media-imdb.com/images/M/MV5BMTgxMjU... 98 min \n",
"1 https://ia.media-imdb.com/images/M/MV5BMjE4OTY... 125 min \n",
"2 https://ia.media-imdb.com/images/M/MV5BMjAwMTY... 140 min \n",
"3 https://ia.media-imdb.com/images/M/MV5BOTU3OTU... 95 min \n",
"4 https://ia.media-imdb.com/images/M/MV5BODc5MzA... 71 min \n",
"5 https://ia.media-imdb.com/images/M/MV5BNjM5MDU... 108 min \n",
"6 https://ia.media-imdb.com/images/M/MV5BMTY2MjM... 138 min \n",
"7 https://ia.media-imdb.com/images/M/MV5BMTM4MDQ... 93 min \n",
"8 https://ia.media-imdb.com/images/M/MV5BMTAxOTM... 95 min \n",
"9 https://ia.media-imdb.com/images/M/MV5BMTk3MjQ... 101 min \n",
"10 https://ia.media-imdb.com/images/M/MV5BMTg1NDU... 133 min \n",
"11 https://ia.media-imdb.com/images/M/MV5BMjIzNzA... 101 min \n",
"12 https://ia.media-imdb.com/images/M/MV5BMTc5NzI... 114 min \n",
"13 https://ia.media-imdb.com/images/M/MV5BOTA5NzA... 92 min \n",
"14 https://ia.media-imdb.com/images/M/MV5BNTQzMmR... 105 min \n",
"15 https://ia.media-imdb.com/images/M/MV5BMDE1MTI... 102 min \n",
"16 https://ia.media-imdb.com/images/M/MV5BMTgxNTE... 91 min \n",
"17 https://ia.media-imdb.com/images/M/MV5BMjM3NDc... 107 min \n",
"18 https://ia.media-imdb.com/images/M/MV5BMjMyNzI... 114 min \n",
"19 https://ia.media-imdb.com/images/M/MV5BMjA0NjU... 99 min \n",
"20 https://ia.media-imdb.com/images/M/MV5BMmE2ZTQ... 102 min \n",
"21 https://ia.media-imdb.com/images/M/MV5BMjM4NDM... 86 min \n",
"22 https://ia.media-imdb.com/images/M/MV5BMjE3NjM... 139 min \n",
"23 https://ia.media-imdb.com/images/M/MV5BMjIxMDY... 84 min \n",
"24 https://ia.media-imdb.com/images/M/MV5BMjE3MDY... 104 min \n",
"25 https://ia.media-imdb.com/images/M/MV5BMTYyMzE... 121 min \n",
"26 https://ia.media-imdb.com/images/M/MV5BMTUxMjQ... 106 min \n",
"27 https://ia.media-imdb.com/images/M/MV5BMjAyNTM... 108 min \n",
"28 https://ia.media-imdb.com/images/M/MV5BMjAyNjk... 92 min \n",
"29 https://ia.media-imdb.com/images/M/MV5BMjM5MTE... 90 min \n",
"30 https://ia.media-imdb.com/images/M/MV5BMjMwOTQ... 97 min \n",
"31 https://ia.media-imdb.com/images/M/MV5BMjA5MDM... 113 min \n",
"32 https://ia.media-imdb.com/images/M/MV5BMTQyNzk... 127 min \n",
"33 https://ia.media-imdb.com/images/M/MV5BMjAxNTg... 102 min \n",
"34 https://ia.media-imdb.com/images/M/MV5BMjYyNDc... 92 min \n",
"35 https://ia.media-imdb.com/images/M/MV5BMTUxMjk... 75 min \n",
"36 https://ia.media-imdb.com/images/M/MV5BMjE1MTM... 125 min \n",
"37 https://ia.media-imdb.com/images/M/MV5BMTkxMjg... 129 min \n",
"38 https://ia.media-imdb.com/images/M/MV5BMTA2MTM... 94 min \n",
"39 https://ia.media-imdb.com/images/M/MV5BMjAwNDA... 86 min \n",
"40 https://ia.media-imdb.com/images/M/MV5BMjcxNzk... 115 min \n",
"41 https://ia.media-imdb.com/images/M/MV5BMTU3NzQ... 93 min \n",
"42 https://ia.media-imdb.com/images/M/MV5BMTc3OTg... 101 min \n",
"43 https://ia.media-imdb.com/images/M/MV5BMjMwNjY... 129 min \n",
"44 https://ia.media-imdb.com/images/M/MV5BNzAzMjA... 122 min \n",
"45 https://ia.media-imdb.com/images/M/MV5BNzE0NDA... 126 min \n",
"46 https://ia.media-imdb.com/images/M/MV5BMTUwODg... 105 min \n",
"47 https://ia.media-imdb.com/images/M/MV5BMjM2ODM... 83 min \n",
"48 https://ia.media-imdb.com/images/M/MV5BMTY3MjQ... 111 min \n",
"49 https://ia.media-imdb.com/images/M/MV5BMTg1NjE... 99 min \n",
"50 https://ia.media-imdb.com/images/M/MV5BNjc4Mjk... 103 min \n",
"51 https://ia.media-imdb.com/images/M/MV5BNjEzODA... 99 min \n",
"52 https://ia.media-imdb.com/images/M/MV5BMjEyNTU... 92 min \n",
"53 https://ia.media-imdb.com/images/M/MV5BMTA5MTU... 92 min \n",
"54 https://ia.media-imdb.com/images/M/MV5BMjEwNDg... 58 min "
]
},
"execution_count": 224,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from pandas import DataFrame\n",
"DataFrame(movie_total)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"train = pd.read_csv(\"data/train.tsv\", sep=\"\\t\", index_col=\"PhraseId\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(156060, 3)\n"
]
}
],
"source": [
"print(train.shape)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>SentenceId</th>\n",
" <th>Phrase</th>\n",
" <th>Sentiment</th>\n",
" </tr>\n",
" <tr>\n",
" <th>PhraseId</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1</td>\n",
" <td>A series of escapades demonstrating the adage ...</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>1</td>\n",
" <td>A series of escapades demonstrating the adage ...</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1</td>\n",
" <td>A series</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>1</td>\n",
" <td>A</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>1</td>\n",
" <td>series</td>\n",
" <td>2</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" SentenceId Phrase \\\n",
"PhraseId \n",
"1 1 A series of escapades demonstrating the adage ... \n",
"2 1 A series of escapades demonstrating the adage ... \n",
"3 1 A series \n",
"4 1 A \n",
"5 1 series \n",
"\n",
" Sentiment \n",
"PhraseId \n",
"1 1 \n",
"2 2 \n",
"3 2 \n",
"4 2 \n",
"5 2 "
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"train.head()"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"test = pd.read_csv(\"data/test.tsv\", sep=\"\\t\", index_col=\"PhraseId\")"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(66292, 2)\n"
]
}
],
"source": [
"print(test.shape)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>SentenceId</th>\n",
" <th>Phrase</th>\n",
" </tr>\n",
" <tr>\n",
" <th>PhraseId</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>156061</th>\n",
" <td>8545</td>\n",
" <td>An intermittently pleasing but mostly routine ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>156062</th>\n",
" <td>8545</td>\n",
" <td>An intermittently pleasing but mostly routine ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>156063</th>\n",
" <td>8545</td>\n",
" <td>An</td>\n",
" </tr>\n",
" <tr>\n",
" <th>156064</th>\n",
" <td>8545</td>\n",
" <td>intermittently pleasing but mostly routine effort</td>\n",
" </tr>\n",
" <tr>\n",
" <th>156065</th>\n",
" <td>8545</td>\n",
" <td>intermittently pleasing but mostly routine</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" SentenceId Phrase\n",
"PhraseId \n",
"156061 8545 An intermittently pleasing but mostly routine ...\n",
"156062 8545 An intermittently pleasing but mostly routine ...\n",
"156063 8545 An\n",
"156064 8545 intermittently pleasing but mostly routine effort\n",
"156065 8545 intermittently pleasing but mostly routine"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"test.head()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"train[\"Phrase(origin)\"] = train[\"Phrase\"].copy()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(156060, 4)\n"
]
}
],
"source": [
"print(train.shape)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Phrase</th>\n",
" <th>Phrase(origin)</th>\n",
" </tr>\n",
" <tr>\n",
" <th>PhraseId</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>A series of escapades demonstrating the adage ...</td>\n",
" <td>A series of escapades demonstrating the adage ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>A series of escapades demonstrating the adage ...</td>\n",
" <td>A series of escapades demonstrating the adage ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>A series</td>\n",
" <td>A series</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>A</td>\n",
" <td>A</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>series</td>\n",
" <td>series</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Phrase \\\n",
"PhraseId \n",
"1 A series of escapades demonstrating the adage ... \n",
"2 A series of escapades demonstrating the adage ... \n",
"3 A series \n",
"4 A \n",
"5 series \n",
"\n",
" Phrase(origin) \n",
"PhraseId \n",
"1 A series of escapades demonstrating the adage ... \n",
"2 A series of escapades demonstrating the adage ... \n",
"3 A series \n",
"4 A \n",
"5 series "
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"train[[\"Phrase\", \"Phrase(origin)\"]].head()"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"test[\"Phrase(origin)\"] = test[\"Phrase\"].copy()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(66292, 3)\n"
]
}
],
"source": [
"print(test.shape)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Phrase</th>\n",
" <th>Phrase(origin)</th>\n",
" </tr>\n",
" <tr>\n",
" <th>PhraseId</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>156061</th>\n",
" <td>An intermittently pleasing but mostly routine ...</td>\n",
" <td>An intermittently pleasing but mostly routine ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>156062</th>\n",
" <td>An intermittently pleasing but mostly routine ...</td>\n",
" <td>An intermittently pleasing but mostly routine ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>156063</th>\n",
" <td>An</td>\n",
" <td>An</td>\n",
" </tr>\n",
" <tr>\n",
" <th>156064</th>\n",
" <td>intermittently pleasing but mostly routine effort</td>\n",
" <td>intermittently pleasing but mostly routine effort</td>\n",
" </tr>\n",
" <tr>\n",
" <th>156065</th>\n",
" <td>intermittently pleasing but mostly routine</td>\n",
" <td>intermittently pleasing but mostly routine</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Phrase \\\n",
"PhraseId \n",
"156061 An intermittently pleasing but mostly routine ... \n",
"156062 An intermittently pleasing but mostly routine ... \n",
"156063 An \n",
"156064 intermittently pleasing but mostly routine effort \n",
"156065 intermittently pleasing but mostly routine \n",
"\n",
" Phrase(origin) \n",
"PhraseId \n",
"156061 An intermittently pleasing but mostly routine ... \n",
"156062 An intermittently pleasing but mostly routine ... \n",
"156063 An \n",
"156064 intermittently pleasing but mostly routine effort \n",
"156065 intermittently pleasing but mostly routine "
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"test[[\"Phrase\", \"Phrase(origin)\"]].head()"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"def clean_text(phrase):\n",
" phrase = phrase.replace(\"doesn't \", \"does not \")\n",
" phrase = phrase.replace(\"ca n't \", \"can not \")\n",
" phrase = phrase.replace(\" n't \", \" not \")\n",
" return phrase"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"train[\"Phrase\"] = train[\"Phrase\"].apply(clean_text)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(156060, 4)\n"
]
}
],
"source": [
"print(train.shape)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Phrase</th>\n",
" <th>Phrase(origin)</th>\n",
" </tr>\n",
" <tr>\n",
" <th>PhraseId</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>A series of escapades demonstrating the adage ...</td>\n",
" <td>A series of escapades demonstrating the adage ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>A series of escapades demonstrating the adage ...</td>\n",
" <td>A series of escapades demonstrating the adage ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>A series</td>\n",
" <td>A series</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>A</td>\n",
" <td>A</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>series</td>\n",
" <td>series</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Phrase \\\n",
"PhraseId \n",
"1 A series of escapades demonstrating the adage ... \n",
"2 A series of escapades demonstrating the adage ... \n",
"3 A series \n",
"4 A \n",
"5 series \n",
"\n",
" Phrase(origin) \n",
"PhraseId \n",
"1 A series of escapades demonstrating the adage ... \n",
"2 A series of escapades demonstrating the adage ... \n",
"3 A series \n",
"4 A \n",
"5 series "
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"train[[\"Phrase\", \"Phrase(origin)\"]].head()"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
"test[\"Phrase\"] = test[\"Phrase\"].apply(clean_text)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(66292, 3)\n"
]
}
],
"source": [
"print(test.shape)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Phrase</th>\n",
" <th>Phrase(origin)</th>\n",
" </tr>\n",
" <tr>\n",
" <th>PhraseId</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>156061</th>\n",
" <td>An intermittently pleasing but mostly routine ...</td>\n",
" <td>An intermittently pleasing but mostly routine ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>156062</th>\n",
" <td>An intermittently pleasing but mostly routine ...</td>\n",
" <td>An intermittently pleasing but mostly routine ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>156063</th>\n",
" <td>An</td>\n",
" <td>An</td>\n",
" </tr>\n",
" <tr>\n",
" <th>156064</th>\n",
" <td>intermittently pleasing but mostly routine effort</td>\n",
" <td>intermittently pleasing but mostly routine effort</td>\n",
" </tr>\n",
" <tr>\n",
" <th>156065</th>\n",
" <td>intermittently pleasing but mostly routine</td>\n",
" <td>intermittently pleasing but mostly routine</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Phrase \\\n",
"PhraseId \n",
"156061 An intermittently pleasing but mostly routine ... \n",
"156062 An intermittently pleasing but mostly routine ... \n",
"156063 An \n",
"156064 intermittently pleasing but mostly routine effort \n",
"156065 intermittently pleasing but mostly routine \n",
"\n",
" Phrase(origin) \n",
"PhraseId \n",
"156061 An intermittently pleasing but mostly routine ... \n",
"156062 An intermittently pleasing but mostly routine ... \n",
"156063 An \n",
"156064 intermittently pleasing but mostly routine effort \n",
"156065 intermittently pleasing but mostly routine "
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"test[[\"Phrase\", \"Phrase(origin)\"]].head()"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"ename": "ImportError",
"evalue": "DLL load failed: 지정된 모듈을 찾을 수 없습니다.",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mImportError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-1-6a1df9f4b4e2>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[0msklearn\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfeature_extraction\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtext\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mCountVectorizer\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;32mc:\\users\\fyj\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\sklearn\\__init__.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 132\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 133\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0m__check_build\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 134\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[0mbase\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mclone\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 135\u001b[0m \u001b[0m__check_build\u001b[0m \u001b[1;31m# avoid flakes unused variable error\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 136\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mc:\\users\\fyj\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\sklearn\\base.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 11\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mscipy\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0msparse\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[0mexternals\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0msix\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 13\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[0mutils\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfixes\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0msignature\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 14\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0m__version__\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 15\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mc:\\users\\fyj\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\sklearn\\utils\\__init__.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 10\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[0mmurmurhash\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mmurmurhash3_32\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 11\u001b[1;33m from .validation import (as_float_array,\n\u001b[0m\u001b[0;32m 12\u001b[0m \u001b[0massert_all_finite\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 13\u001b[0m \u001b[0mcheck_random_state\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcolumn_or_1d\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcheck_array\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mc:\\users\\fyj\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\sklearn\\utils\\validation.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 16\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 17\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mexternals\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0msix\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 18\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mutils\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfixes\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0msignature\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 19\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[1;33m.\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mget_config\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0m_get_config\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 20\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mexceptions\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mNonBLASDotWarning\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mc:\\users\\fyj\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\sklearn\\utils\\fixes.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 142\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[0m_scipy_sparse_lsqr_backport\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mlsqr\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0msparse_lsqr\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 143\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 144\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[0mscipy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msparse\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlinalg\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mlsqr\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0msparse_lsqr\u001b[0m \u001b[1;31m# noqa\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 145\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 146\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mc:\\users\\fyj\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\scipy\\sparse\\linalg\\__init__.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 112\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0m__future__\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mdivision\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mprint_function\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mabsolute_import\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 113\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 114\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[0misolve\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[1;33m*\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 115\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[0mdsolve\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[1;33m*\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 116\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[0minterface\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[1;33m*\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mc:\\users\\fyj\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\scipy\\sparse\\linalg\\isolve\\__init__.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;31m#from info import __doc__\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[0miterative\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[1;33m*\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 7\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[0mminres\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mminres\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m\u001b[0mlgmres\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mlgmres\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mc:\\users\\fyj\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\scipy\\sparse\\linalg\\isolve\\iterative.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 10\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[1;33m.\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0m_iterative\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 11\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mscipy\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msparse\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlinalg\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0minterface\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mLinearOperator\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mImportError\u001b[0m: DLL load failed: 지정된 모듈을 찾을 수 없습니다."
]
}
],
"source": [
"from sklearn.feature_extraction.text import CountVectorizer"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"from numpy.lib.stride_tricks import as_strided"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[1., 2., 3., 4.],\n",
" [2., 3., 4., 5.]])"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"n=5; k=2\n",
"a=np.linspace(1,n,n); aid=id(a)\n",
"as_strided(a, (k, n), (8, 8))\n",
"as_strided(a, (k, n-k+1), (8,8))"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"def shift1(x,k):\n",
" return np.vstack([x[i:n-k+i+1] for i in range(k)])\n",
"\n",
"def shift2(x,k):\n",
" return as_strided(x, (k, n-k+1), (x.itemsize,)*2)\n",
"\n",
"b = shift1(a,k); b, id(b) == aid\n",
"c = shift2(a,k); c, id(c) == aid\n",
"n, k = 100, 10\n",
"t = np.linspace(0., 1., n)\n",
"x = t+.1*np.random.randn(n)\n",
"y=shift2(x,k)\n",
"x_avg = y.mean(axis=0)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"17.9 µs ± 39.1 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)\n"
]
}
],
"source": [
"%timeit shift1(x,k)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"7.09 µs ± 23.8 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)\n"
]
}
],
"source": [
"%timeit shift2(x,k)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import findspark"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import os"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"findspark.init()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"import pyspark"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"try:\n",
" sc = pyspark.SparkContext()\n",
"except:\n",
" pass"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"64"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lines = sc.textFile(\"C://Users/fyj/spark-2.3.0-bin-hadoop2.7/README.md\")\n",
"lines_nonempty = lines.filter( lambda x: len(x) > 0 )\n",
"lines_nonempty.count()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['# Apache Spark',\n",
" '',\n",
" 'Spark is a fast and general cluster computing system for Big Data. It provides',\n",
" 'high-level APIs in Scala, Java, Python, and R, and an optimized engine that',\n",
" 'supports general computation graphs for data analysis. It also supports a',\n",
" 'rich set of higher-level tools including Spark SQL for SQL and DataFrames,',\n",
" 'MLlib for machine learning, GraphX for graph processing,',\n",
" 'and Spark Streaming for stream processing.',\n",
" '',\n",
" '<http://spark.apache.org/>',\n",
" '',\n",
" '',\n",
" '## Online Documentation',\n",
" '',\n",
" 'You can find the latest Spark documentation, including a programming',\n",
" 'guide, on the [project web page](http://spark.apache.org/documentation.html).',\n",
" 'This README file only contains basic setup instructions.',\n",
" '',\n",
" '## Building Spark',\n",
" '',\n",
" 'Spark is built using [Apache Maven](http://maven.apache.org/).',\n",
" 'To build Spark and its example programs, run:',\n",
" '',\n",
" ' build/mvn -DskipTests clean package',\n",
" '',\n",
" '(You do not need to do this if you downloaded a pre-built package.)',\n",
" '',\n",
" 'You can build Spark using more than one thread by using the -T option with Maven, see [\"Parallel builds in Maven 3\"](https://cwiki.apache.org/confluence/display/MAVEN/Parallel+builds+in+Maven+3).',\n",
" 'More detailed documentation is available from the project site, at',\n",
" '[\"Building Spark\"](http://spark.apache.org/docs/latest/building-spark.html).',\n",
" '',\n",
" 'For general development tips, including info on developing Spark using an IDE, see [\"Useful Developer Tools\"](http://spark.apache.org/developer-tools.html).',\n",
" '',\n",
" '## Interactive Scala Shell',\n",
" '',\n",
" 'The easiest way to start using Spark is through the Scala shell:',\n",
" '',\n",
" ' ./bin/spark-shell',\n",
" '',\n",
" 'Try the following command, which should return 1000:',\n",
" '',\n",
" ' scala> sc.parallelize(1 to 1000).count()',\n",
" '',\n",
" '## Interactive Python Shell',\n",
" '',\n",
" 'Alternatively, if you prefer Python, you can use the Python shell:',\n",
" '',\n",
" ' ./bin/pyspark',\n",
" '',\n",
" 'And run the following command, which should also return 1000:',\n",
" '',\n",
" ' >>> sc.parallelize(range(1000)).count()',\n",
" '',\n",
" '## Example Programs',\n",
" '',\n",
" 'Spark also comes with several sample programs in the `examples` directory.',\n",
" 'To run one of them, use `./bin/run-example <class> [params]`. For example:',\n",
" '',\n",
" ' ./bin/run-example SparkPi',\n",
" '',\n",
" 'will run the Pi example locally.',\n",
" '',\n",
" 'You can set the MASTER environment variable when running examples to submit',\n",
" 'examples to a cluster. This can be a mesos:// or spark:// URL,',\n",
" '\"yarn\" to run on YARN, and \"local\" to run',\n",
" 'locally with one thread, or \"local[N]\" to run locally with N threads. You',\n",
" 'can also use an abbreviated class name if the class is in the `examples`',\n",
" 'package. For instance:',\n",
" '',\n",
" ' MASTER=spark://host:7077 ./bin/run-example SparkPi',\n",
" '',\n",
" 'Many of the example programs print usage help if no params are given.',\n",
" '',\n",
" '## Running Tests',\n",
" '',\n",
" 'Testing first requires [building Spark](#building-spark). Once Spark is built, tests',\n",
" 'can be run using:',\n",
" '',\n",
" ' ./dev/run-tests',\n",
" '',\n",
" 'Please see the guidance on how to',\n",
" '[run tests for a module, or individual tests](http://spark.apache.org/developer-tools.html#individual-tests).',\n",
" '',\n",
" '## A Note About Hadoop Versions',\n",
" '',\n",
" 'Spark uses the Hadoop core library to talk to HDFS and other Hadoop-supported',\n",
" 'storage systems. Because the protocols have changed in different versions of',\n",
" 'Hadoop, you must build Spark against the same version that your cluster runs.',\n",
" '',\n",
" 'Please refer to the build documentation at',\n",
" '[\"Specifying the Hadoop Version\"](http://spark.apache.org/docs/latest/building-spark.html#specifying-the-hadoop-version)',\n",
" 'for detailed guidance on building for a particular distribution of Hadoop, including',\n",
" 'building for particular Hive and Hive Thriftserver distributions.',\n",
" '',\n",
" '## Configuration',\n",
" '',\n",
" 'Please refer to the [Configuration Guide](http://spark.apache.org/docs/latest/configuration.html)',\n",
" 'in the online documentation for an overview on how to configure Spark.',\n",
" '',\n",
" '## Contributing',\n",
" '',\n",
" 'Please review the [Contribution to Spark guide](http://spark.apache.org/contributing.html)',\n",
" 'for information on how to get started contributing to the project.']"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lines.collect()"
]
},
{
"cell_type": "code",
"execution_count": 107,
"metadata": {},
"outputs": [],
"source": [
"rdd = sc.parallelize([1,2])"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[(1, 1), (2, 1), (3, 1), (3, 1)]"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sorted(rdd.map(lambda x: (x,1)).collect())"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1, 1, 1, 2, 2]"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sorted(rdd.flatMap(lambda x:range(1,x)).collect())"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[2]"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd.filter(lambda x:x%2==0).collect()"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1, 2, 3]"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sorted(rdd.distinct().collect())"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1, 2, 3, 3]"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd.collect()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd.count()"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"defaultdict(int, {1: 1, 2: 1, 3: 2})"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd.countByValue()"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1, 2]"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd.take(2)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[3, 3]"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd.top(2)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[3, 3]"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd.takeOrdered(2, key=lambda x:-x)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[2, 2]"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd.takeSample(True,2)"
]
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-63"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd.reduce(lambda x,y:3*(x-y))"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1]"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd.sample(False, 0.5).collect()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"rdd.fold(0, lambda x,y:x + 4*y)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"rdd.reduce(lambda x,y:x + 4*y)"
]
},
{
"cell_type": "code",
"execution_count": 82,
"metadata": {},
"outputs": [],
"source": [
"seqOp=(lambda x,y:(x[0]+y,x[1]+1))"
]
},
{
"cell_type": "code",
"execution_count": 83,
"metadata": {},
"outputs": [],
"source": [
"combOp=(lambda x, y:(x[0]+y[0],x[1]+y[1]))"
]
},
{
"cell_type": "code",
"execution_count": 84,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(9, 4)"
]
},
"execution_count": 84,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd.aggregate((0,0), seqOp, combOp)"
]
},
{
"cell_type": "code",
"execution_count": 91,
"metadata": {},
"outputs": [],
"source": [
"rdd2=sc.parallelize([(1,2),(3,4),(3,6)])"
]
},
{
"cell_type": "code",
"execution_count": 93,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[(1, 2), (3, 10)]"
]
},
"execution_count": 93,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd2.reduceByKey(lambda x,y:x+y).collect()"
]
},
{
"cell_type": "code",
"execution_count": 94,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[(1, [2]), (3, [4, 6])]"
]
},
"execution_count": 94,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd2.groupByKey().mapValues(list).collect()"
]
},
{
"cell_type": "code",
"execution_count": 99,
"metadata": {},
"outputs": [],
"source": [
"from operator import add"
]
},
{
"cell_type": "code",
"execution_count": 101,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[(1, '2'), (3, '46')]"
]
},
"execution_count": 101,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd2.combineByKey(str,add,add).collect()"
]
},
{
"cell_type": "code",
"execution_count": 103,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[(1, 3), (3, 5), (3, 7)]"
]
},
"execution_count": 103,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rdd2.mapValues(lambda x:x+1).collect()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"#: 1\n",
"Apache: 1\n",
"Spark: 16\n",
": 71\n",
"is: 6\n",
"a: 8\n",
"fast: 1\n",
"and: 9\n",
"general: 3\n",
"cluster: 2\n",
"computing: 1\n",
"system: 1\n",
"for: 12\n",
"Big: 1\n",
"Data.: 1\n",
"It: 2\n",
"provides: 1\n",
"high-level: 1\n",
"APIs: 1\n",
"in: 6\n",
"Scala,: 1\n",
"Java,: 1\n",
"Python,: 2\n",
"R,: 1\n",
"an: 4\n",
"optimized: 1\n",
"engine: 1\n",
"that: 2\n",
"supports: 2\n",
"computation: 1\n",
"graphs: 1\n",
"data: 1\n",
"analysis.: 1\n",
"also: 4\n",
"rich: 1\n",
"set: 2\n",
"of: 5\n",
"higher-level: 1\n",
"tools: 1\n",
"including: 4\n",
"SQL: 2\n",
"DataFrames,: 1\n",
"MLlib: 1\n",
"machine: 1\n",
"learning,: 1\n",
"GraphX: 1\n",
"graph: 1\n",
"processing,: 1\n",
"Streaming: 1\n",
"stream: 1\n",
"processing.: 1\n",
"<http://spark.apache.org/>: 1\n",
"##: 9\n",
"Online: 1\n",
"Documentation: 1\n",
"You: 4\n",
"can: 7\n",
"find: 1\n",
"the: 24\n",
"latest: 1\n",
"documentation,: 1\n",
"programming: 1\n",
"guide,: 1\n",
"on: 7\n",
"[project: 1\n",
"web: 1\n",
"page](http://spark.apache.org/documentation.html).: 1\n",
"This: 2\n",
"README: 1\n",
"file: 1\n",
"only: 1\n",
"contains: 1\n",
"basic: 1\n",
"setup: 1\n",
"instructions.: 1\n",
"Building: 1\n",
"built: 1\n",
"using: 5\n",
"[Apache: 1\n",
"Maven](http://maven.apache.org/).: 1\n",
"To: 2\n",
"build: 4\n",
"its: 1\n",
"example: 3\n",
"programs,: 1\n",
"run:: 1\n",
"build/mvn: 1\n",
"-DskipTests: 1\n",
"clean: 1\n",
"package: 1\n",
"(You: 1\n",
"do: 2\n",
"not: 1\n",
"need: 1\n",
"to: 17\n",
"this: 1\n",
"if: 4\n",
"you: 4\n",
"downloaded: 1\n",
"pre-built: 1\n",
"package.): 1\n",
"more: 1\n",
"than: 1\n",
"one: 3\n",
"thread: 1\n",
"by: 1\n",
"-T: 1\n",
"option: 1\n",
"with: 4\n",
"Maven,: 1\n",
"see: 3\n",
"[\"Parallel: 1\n",
"builds: 1\n",
"Maven: 1\n",
"3\"](https://cwiki.apache.org/confluence/display/MAVEN/Parallel+builds+in+Maven+3).: 1\n",
"More: 1\n",
"detailed: 2\n",
"documentation: 3\n",
"available: 1\n",
"from: 1\n",
"project: 1\n",
"site,: 1\n",
"at: 2\n",
"[\"Building: 1\n",
"Spark\"](http://spark.apache.org/docs/latest/building-spark.html).: 1\n",
"For: 3\n",
"development: 1\n",
"tips,: 1\n",
"info: 1\n",
"developing: 1\n",
"IDE,: 1\n",
"[\"Useful: 1\n",
"Developer: 1\n",
"Tools\"](http://spark.apache.org/developer-tools.html).: 1\n",
"Interactive: 2\n",
"Scala: 2\n",
"Shell: 2\n",
"The: 1\n",
"easiest: 1\n",
"way: 1\n",
"start: 1\n",
"through: 1\n",
"shell:: 2\n",
"./bin/spark-shell: 1\n",
"Try: 1\n",
"following: 2\n",
"command,: 2\n",
"which: 2\n",
"should: 2\n",
"return: 2\n",
"1000:: 2\n",
"scala>: 1\n",
"sc.parallelize(1: 1\n",
"1000).count(): 1\n",
"Python: 2\n",
"Alternatively,: 1\n",
"prefer: 1\n",
"use: 3\n",
"./bin/pyspark: 1\n",
"And: 1\n",
"run: 7\n",
">>>: 1\n",
"sc.parallelize(range(1000)).count(): 1\n",
"Example: 1\n",
"Programs: 1\n",
"comes: 1\n",
"several: 1\n",
"sample: 1\n",
"programs: 2\n",
"`examples`: 2\n",
"directory.: 1\n",
"them,: 1\n",
"`./bin/run-example: 1\n",
"<class>: 1\n",
"[params]`.: 1\n",
"example:: 1\n",
"./bin/run-example: 2\n",
"SparkPi: 2\n",
"will: 1\n",
"Pi: 1\n",
"locally.: 1\n",
"MASTER: 1\n",
"environment: 1\n",
"variable: 1\n",
"when: 1\n",
"running: 1\n",
"examples: 2\n",
"submit: 1\n",
"cluster.: 1\n",
"be: 2\n",
"mesos://: 1\n",
"or: 3\n",
"spark://: 1\n",
"URL,: 1\n",
"\"yarn\": 1\n",
"YARN,: 1\n",
"\"local\": 1\n",
"locally: 2\n",
"thread,: 1\n",
"\"local[N]\": 1\n",
"N: 1\n",
"threads.: 1\n",
"abbreviated: 1\n",
"class: 2\n",
"name: 1\n",
"package.: 1\n",
"instance:: 1\n",
"MASTER=spark://host:7077: 1\n",
"Many: 1\n",
"print: 1\n",
"usage: 1\n",
"help: 1\n",
"no: 1\n",
"params: 1\n",
"are: 1\n",
"given.: 1\n",
"Running: 1\n",
"Tests: 1\n",
"Testing: 1\n",
"first: 1\n",
"requires: 1\n",
"[building: 1\n",
"Spark](#building-spark).: 1\n",
"Once: 1\n",
"built,: 1\n",
"tests: 2\n",
"using:: 1\n",
"./dev/run-tests: 1\n",
"Please: 4\n",
"guidance: 2\n",
"how: 3\n",
"[run: 1\n",
"module,: 1\n",
"individual: 1\n",
"tests](http://spark.apache.org/developer-tools.html#individual-tests).: 1\n",
"A: 1\n",
"Note: 1\n",
"About: 1\n",
"Hadoop: 3\n",
"Versions: 1\n",
"uses: 1\n",
"core: 1\n",
"library: 1\n",
"talk: 1\n",
"HDFS: 1\n",
"other: 1\n",
"Hadoop-supported: 1\n",
"storage: 1\n",
"systems.: 1\n",
"Because: 1\n",
"protocols: 1\n",
"have: 1\n",
"changed: 1\n",
"different: 1\n",
"versions: 1\n",
"Hadoop,: 2\n",
"must: 1\n",
"against: 1\n",
"same: 1\n",
"version: 1\n",
"your: 1\n",
"runs.: 1\n",
"refer: 2\n",
"[\"Specifying: 1\n",
"Version\"](http://spark.apache.org/docs/latest/building-spark.html#specifying-the-hadoop-version): 1\n",
"building: 2\n",
"particular: 2\n",
"distribution: 1\n",
"Hive: 2\n",
"Thriftserver: 1\n",
"distributions.: 1\n",
"Configuration: 1\n",
"[Configuration: 1\n",
"Guide](http://spark.apache.org/docs/latest/configuration.html): 1\n",
"online: 1\n",
"overview: 1\n",
"configure: 1\n",
"Spark.: 1\n",
"Contributing: 1\n",
"review: 1\n",
"[Contribution: 1\n",
"guide](http://spark.apache.org/contributing.html): 1\n",
"information: 1\n",
"get: 1\n",
"started: 1\n",
"contributing: 1\n",
"project.: 1\n"
]
}
],
"source": [
"from __future__ import print_function\n",
"import sys\n",
"from operator import add\n",
"from pyspark.sql import SparkSession\n",
"if __name__ == \"__main__\":\n",
" spark=SparkSession\\\n",
" .builder\\\n",
" .appName(\"PythonWordCount\")\\\n",
" .getOrCreate()\n",
" \n",
" lines = spark.read.text(\"C://Users/fyj/spark-2.3.0-bin-hadoop2.7/README.md\")\\\n",
" .rdd.map(lambda r: r[0])\n",
" \n",
" counts = lines.flatMap(lambda x: x.split(' '))\\\n",
" .map(lambda x: (x,1))\\\n",
" .reduceByKey(add)\n",
" \n",
" output = counts.collect()\n",
" \n",
" for (word, count) in output:\n",
" print(\"%s: %i\" % (word, count))\n",
" \n",
" spark.stop()"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[('John', 'iPhone Cover', '9.99'),\n",
" ('John', 'Headphones', '5.49'),\n",
" ('Jack', 'iPhone Cover', '9.99'),\n",
" ('Jill', 'Samsung Galaxy Cover', '8.95'),\n",
" ('Bob', 'iPad Cover', '5.49')]"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data = sc.textFile(\"UserPurchaseHistory.csv\").map(lambda line:\n",
"line.split(\",\")).map(lambda record: (record[0], record[1], record[2]))\n",
"#data = sc.parallelize(data1)\n",
"numPurchases = data.count()\n",
"data.collect()"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"uniqueUsers = data.map(lambda record: record[0]).distinct().count()\n",
"uniqueUsers"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [],
"source": [
"totalRevenue = data.map(lambda record: float(record[2])).sum()"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Total purchases: 5\n",
"Unique users: 4\n",
"Total Revenue: 39.91\n",
"Most popular product: iPhone Cover with 2.0 purchases\n"
]
},
{
"data": {
"text/plain": [
"[('Headphones', 1.0),\n",
" ('Samsung Galaxy Cover', 1.0),\n",
" ('iPad Cover', 1.0),\n",
" ('iPhone Cover', 2.0)]"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"products = data.map(lambda record: (record[1], 1.0)).reduceByKey(lambda a, b: a+b).collect()\n",
"MostPopular = sorted(products, key=lambda x: x[1], reverse=True)[0]\n",
"print(\"Total purchases: {0}\\nUnique users: {1}\\nTotal Revenue: {2}\\nMost popular product: {3} with {4} purchases\"\n",
" .format(numPurchases, uniqueUsers, totalRevenue, MostPopular[0],MostPopular[1]))\n",
"products"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[('pandas', 2), ('pandas', 20), ('pandas', 21)]\n"
]
}
],
"source": [
"import sys\n",
"import itertools\n",
"from pyspark import SparkContext\n",
"\n",
"def combineIfBothPresent(itrs):\n",
" iter1 = itrs[0].__iter__()\n",
" iter2 = itrs[1].__iter__()\n",
" try:\n",
" e1 = iter1.__next__()\n",
" e2 = iter2.__next__()\n",
" return itertools.chain([e1], [e2], iter1, iter2)\n",
" except StopIteration:\n",
" return []\n",
"\n",
"def intersectByKey(rdd1, rdd2):\n",
" return rdd1.cogroup(rdd2).flatMapValues(combineIfBothPresent)\n",
"\n",
"if __name__ == \"__main__\":\n",
" master = \"local\"\n",
" if len(sys.argv) == 2:\n",
" master == sys.argv[1]\n",
" rdd1 = sc.parallelize([(\"coffee\", 1), (\"pandas\",2), (\"coffee\", 3), (\"very\", 4)])\n",
" rdd2 = sc.parallelize([(\"pandas\", 20), (\"pandas\", 21)])\n",
" #combineIfBothPresent\n",
" print(intersectByKey(rdd1, rdd2).collect())"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Using matplotlib backend: TkAgg\n",
"Populating the interactive namespace from numpy and matplotlib\n"
]
}
],
"source": [
"%pylab"
]
},
{
"cell_type": "code",
"execution_count": 73,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0xe421370>]"
]
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = linspace(-10., 10., 1000)\n",
"plot(x,sin(x))"
]
},
{
"cell_type": "code",
"execution_count": 74,
"metadata": {},
"outputs": [],
"source": [
"from pylab import plot, show"
]
},
{
"cell_type": "code",
"execution_count": 75,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0xecbc910>]"
]
},
"execution_count": 75,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y = [1.0, 2.4, 1.7, 0.3, 0.6, 1.8]\n",
"plot(y)"
]
},
{
"cell_type": "code",
"execution_count": 77,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0xeb9cef0>]"
]
},
"execution_count": 77,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data = loadtxt(\"values.txt\", float)\n",
"x = data[:,0]\n",
"y = data[:,1]\n",
"plot(x,y)"
]
},
{
"cell_type": "code",
"execution_count": 91,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Text(0,0.5,'y = sin (x)')"
]
},
"execution_count": 91,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = linspace(-10., 10., 1000)\n",
"y=sin(x)\n",
"plot(x,y)\n",
"ylim(-2.1, 2.1)\n",
"xlabel(\"x axis\")\n",
"ylabel(\"y = sin (x)\")"
]
},
{
"cell_type": "code",
"execution_count": 125,
"metadata": {},
"outputs": [],
"source": [
"import numpy\n",
"\n",
"data = loadtxt(\"sunspots.txt\", float)\n",
"\n",
"def movingaverage(interval, window_size):\n",
" window = numpy.ones(int(window_size))/float(window_size)\n",
" return numpy.convolve(interval, window, 'same')\n",
"\n",
"x = data[:,0]\n",
"y = data[:,1]\n",
"plot(x,y,\"k.\")\n",
"\n",
"y_av = movingaverage(y,10)\n",
"plot(x,y_av, \"r\")\n",
"xlim(0,1000)\n",
"xlabel(\"Months since Jan 1749\")\n",
"ylabel(\"No. of Sun spots\")\n",
"grid(True)"
]
},
{
"cell_type": "code",
"execution_count": 107,
"metadata": {},
"outputs": [],
"source": [
"window = numpy.ones(int(10))/float(10)"
]
},
{
"cell_type": "code",
"execution_count": 101,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1])"
]
},
"execution_count": 101,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"window"
]
},
{
"cell_type": "code",
"execution_count": 102,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([58. , 62.6, 70. , ..., 25.2, 23.5, 21.6])"
]
},
"execution_count": 102,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y"
]
},
{
"cell_type": "code",
"execution_count": 103,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([33.13, 41.48, 50.96, ..., 13.63, 12.83, 11.96])"
]
},
"execution_count": 103,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y_av"
]
},
{
"cell_type": "code",
"execution_count": 104,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3143"
]
},
"execution_count": 104,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"size(y_av)"
]
},
{
"cell_type": "code",
"execution_count": 105,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3143"
]
},
"execution_count": 105,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"size(y)"
]
},
{
"cell_type": "code",
"execution_count": 122,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"50.959999999999994"
]
},
"execution_count": 122,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mean(y[0:7])*7/10"
]
},
{
"cell_type": "code",
"execution_count": 116,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([33.13, 41.48, 50.96, 57.59, 65.18, 72.73, 82.79, 85.05, 85.38,\n",
" 87.4 ])"
]
},
"execution_count": 116,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y_av[0:10]"
]
},
{
"cell_type": "code",
"execution_count": 119,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([58. , 62.6, 70. , 55.7, 85. , 83.5, 94.8, 66.3, 75.9, 75.5])"
]
},
"execution_count": 119,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y[0:10]"
]
},
{
"cell_type": "code",
"execution_count": 124,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.collections.PathCollection at 0xf10b2f0>"
]
},
"execution_count": 124,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"scatter(x,y)"
]
},
{
"cell_type": "code",
"execution_count": 143,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x177a71f0>"
]
},
"execution_count": 143,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"img = imread(\"smilodon-3377818__340.png\")\n",
"imshow(img)"
]
},
{
"cell_type": "code",
"execution_count": 142,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x151f8190>"
]
},
"execution_count": 142,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"grid = loadtxt(\"stm.txt\")\n",
"imshow(grid)"
]
},
{
"cell_type": "code",
"execution_count": 148,
"metadata": {},
"outputs": [],
"source": [
"def plot_slope(X,Y):\n",
" Xs = X[1:] - X[:-1]\n",
" Ys = Y[1:] - Y[:-1]\n",
" plot(X[1:], Ys/Xs)\n",
"\n",
"X = linspace(-3, 3, 100)\n",
"Y = exp(-X ** 2)\n",
"plot(X,Y)\n",
"plot_slope(X,Y)"
]
},
{
"cell_type": "code",
"execution_count": 156,
"metadata": {},
"outputs": [],
"source": [
"data = loadtxt('my_data.txt')\n",
"\n",
"for column in data.T:\n",
" plot(data[:,0], column)"
]
},
{
"cell_type": "code",
"execution_count": 155,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0., 0., 6.])"
]
},
"execution_count": 155,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data.T[:,0]"
]
},
{
"cell_type": "code",
"execution_count": 162,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0xf5ad1b0>]"
]
},
"execution_count": 162,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"with open('my_data.txt', 'r') as f:\n",
" x, y, *_ = zip(*[[float(s) for s in line.split()] for line in f])\n",
"plot(x,y)"
]
},
{
"cell_type": "code",
"execution_count": 164,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.collections.PathCollection at 0xfd869b0>"
]
},
"execution_count": 164,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data = random.rand(1024,2)\n",
"scatter(data[:,0], data[:,1])"
]
},
{
"cell_type": "code",
"execution_count": 168,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<BarContainer object of 4 artists>"
]
},
"execution_count": 168,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data = [5., 25., 50., 20.]\n",
"bar(range(len(data)), data) #bar(range(len(data)), data, width = 1.) 넓이 1"
]
},
{
"cell_type": "code",
"execution_count": 169,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<BarContainer object of 4 artists>"
]
},
"execution_count": 169,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"barh(range(len(data)), data) #bar(range(len(data)), data, width = 1.) 넓이 1"
]
},
{
"cell_type": "code",
"execution_count": 178,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0xf47c190>"
]
},
"execution_count": 178,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"random.seed(12)\n",
"for i in range(8):\n",
" x = arange(1000)\n",
" y = random.randn(1000).cumsum()\n",
" plot(x,y, label=str(i))\n",
"legend()"
]
},
{
"cell_type": "code",
"execution_count": 181,
"metadata": {},
"outputs": [
{
"ename": "KeyError",
"evalue": "'axes.color_cycle is not a valid rc parameter. See rcParams.keys() for a list of valid parameters.'",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mc:\\users\\fyj\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\matplotlib\\__init__.py\u001b[0m in \u001b[0;36m__setitem__\u001b[1;34m(self, key, val)\u001b[0m\n\u001b[0;32m 921\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 922\u001b[1;33m \u001b[0mcval\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mvalidate\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mval\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 923\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mValueError\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mve\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mKeyError\u001b[0m: 'axes.color_cycle'",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-181-88f8132df23f>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[0mx\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0marange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[0my\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mrandom\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrandn\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcumsum\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[0mppl\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mplot\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mlabel\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mstr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 7\u001b[0m \u001b[0mppl\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlegend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mc:\\users\\fyj\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\prettyplotlib\\colors.py\u001b[0m in \u001b[0;36mwrapper\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 32\u001b[0m \u001b[1;33m@\u001b[0m\u001b[0mwraps\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 33\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 34\u001b[1;33m \u001b[1;32mwith\u001b[0m \u001b[0mmpl\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrc_context\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrc\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mrcParams\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 35\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 36\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mc:\\users\\fyj\\appdata\\local\\programs\\python\\python36-32\\lib\\contextlib.py\u001b[0m in \u001b[0;36m__enter__\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 79\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m__enter__\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 80\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 81\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgen\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 82\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 83\u001b[0m \u001b[1;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"generator didn't yield\"\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mc:\\users\\fyj\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\matplotlib\\__init__.py\u001b[0m in \u001b[0;36mrc_context\u001b[1;34m(rc, fname)\u001b[0m\n\u001b[0;32m 1334\u001b[0m \u001b[0mrc_file\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1335\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mrc\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1336\u001b[1;33m \u001b[0mrcParams\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mupdate\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrc\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1337\u001b[0m \u001b[1;32myield\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1338\u001b[0m \u001b[1;32mfinally\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mc:\\users\\fyj\\appdata\\local\\programs\\python\\python36-32\\lib\\_collections_abc.py\u001b[0m in \u001b[0;36mupdate\u001b[1;34m(*args, **kwds)\u001b[0m\n\u001b[0;32m 839\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mother\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mMapping\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 840\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mkey\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mother\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 841\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mother\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 842\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0mhasattr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mother\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"keys\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 843\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mkey\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mother\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mc:\\users\\fyj\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\matplotlib\\__init__.py\u001b[0m in \u001b[0;36m__setitem__\u001b[1;34m(self, key, val)\u001b[0m\n\u001b[0;32m 927\u001b[0m raise KeyError(\n\u001b[0;32m 928\u001b[0m \u001b[1;34m'%s is not a valid rc parameter. See rcParams.keys() for a '\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 929\u001b[1;33m 'list of valid parameters.' % (key,))\n\u001b[0m\u001b[0;32m 930\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 931\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m__getitem__\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mKeyError\u001b[0m: 'axes.color_cycle is not a valid rc parameter. See rcParams.keys() for a list of valid parameters.'"
]
}
],
"source": [
"import prettyplotlib as ppl\n",
"random.seed(12)\n",
"for i in range(8):\n",
" x = arange(1000)\n",
" y = random.randn(1000).cumsum()\n",
" ppl.plot(x,y, label=str(i))\n",
"ppl.legend()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.collections.QuadMesh at 0x1156eb30>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import seaborn as sns\n",
"import pandas as pd\n",
"\n",
"random.seed(12)\n",
"pcolormesh(random.rand(16,16))\n",
"colorbar()\n",
"random.seed(12)\n",
"pcolormesh(random.rand(16,16))"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import seaborn as sns"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"import bokeh.plotting as bkh"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <div class=\"bk-root\">\n",
" <a href=\"https://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
" <span id=\"eaf280a4-3089-48d3-a944-2396a28397ea\">Loading BokehJS ...</span>\n",
" </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function(root) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
"\n",
" var force = true;\n",
"\n",
" if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
" root._bokeh_onload_callbacks = [];\n",
" root._bokeh_is_loading = undefined;\n",
" }\n",
"\n",
" var JS_MIME_TYPE = 'application/javascript';\n",
" var HTML_MIME_TYPE = 'text/html';\n",
" var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
" var CLASS_NAME = 'output_bokeh rendered_html';\n",
"\n",
" /**\n",
" * Render data to the DOM node\n",
" */\n",
" function render(props, node) {\n",
" var script = document.createElement(\"script\");\n",
" node.appendChild(script);\n",
" }\n",
"\n",
" /**\n",
" * Handle when an output is cleared or removed\n",
" */\n",
" function handleClearOutput(event, handle) {\n",
" var cell = handle.cell;\n",
"\n",
" var id = cell.output_area._bokeh_element_id;\n",
" var server_id = cell.output_area._bokeh_server_id;\n",
" // Clean up Bokeh references\n",
" if (id !== undefined) {\n",
" Bokeh.index[id].model.document.clear();\n",
" delete Bokeh.index[id];\n",
" }\n",
"\n",
" if (server_id !== undefined) {\n",
" // Clean up Bokeh references\n",
" var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
" cell.notebook.kernel.execute(cmd, {\n",
" iopub: {\n",
" output: function(msg) {\n",
" var element_id = msg.content.text.trim();\n",
" Bokeh.index[element_id].model.document.clear();\n",
" delete Bokeh.index[element_id];\n",
" }\n",
" }\n",
" });\n",
" // Destroy server and session\n",
" var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
" cell.notebook.kernel.execute(cmd);\n",
" }\n",
" }\n",
"\n",
" /**\n",
" * Handle when a new output is added\n",
" */\n",
" function handleAddOutput(event, handle) {\n",
" var output_area = handle.output_area;\n",
" var output = handle.output;\n",
"\n",
" // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
" if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
" return\n",
" }\n",
"\n",
" var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
"\n",
" if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
" toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
" // store reference to embed id on output_area\n",
" output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
" }\n",
" if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
" var bk_div = document.createElement(\"div\");\n",
" bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
" var script_attrs = bk_div.children[0].attributes;\n",
" for (var i = 0; i < script_attrs.length; i++) {\n",
" toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
" }\n",
" // store reference to server id on output_area\n",
" output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
" }\n",
" }\n",
"\n",
" function register_renderer(events, OutputArea) {\n",
"\n",
" function append_mime(data, metadata, element) {\n",
" // create a DOM node to render to\n",
" var toinsert = this.create_output_subarea(\n",
" metadata,\n",
" CLASS_NAME,\n",
" EXEC_MIME_TYPE\n",
" );\n",
" this.keyboard_manager.register_events(toinsert);\n",
" // Render to node\n",
" var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
" render(props, toinsert[toinsert.length - 1]);\n",
" element.append(toinsert);\n",
" return toinsert\n",
" }\n",
"\n",
" /* Handle when an output is cleared or removed */\n",
" events.on('clear_output.CodeCell', handleClearOutput);\n",
" events.on('delete.Cell', handleClearOutput);\n",
"\n",
" /* Handle when a new output is added */\n",
" events.on('output_added.OutputArea', handleAddOutput);\n",
"\n",
" /**\n",
" * Register the mime type and append_mime function with output_area\n",
" */\n",
" OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
" /* Is output safe? */\n",
" safe: true,\n",
" /* Index of renderer in `output_area.display_order` */\n",
" index: 0\n",
" });\n",
" }\n",
"\n",
" // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
" if (root.Jupyter !== undefined) {\n",
" var events = require('base/js/events');\n",
" var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
"\n",
" if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
" register_renderer(events, OutputArea);\n",
" }\n",
" }\n",
"\n",
" \n",
" if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
" root._bokeh_timeout = Date.now() + 5000;\n",
" root._bokeh_failed_load = false;\n",
" }\n",
"\n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
"\n",
" function display_loaded() {\n",
" var el = document.getElementById(\"eaf280a4-3089-48d3-a944-2396a28397ea\");\n",
" if (el != null) {\n",
" el.textContent = \"BokehJS is loading...\";\n",
" }\n",
" if (root.Bokeh !== undefined) {\n",
" if (el != null) {\n",
" el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
" }\n",
" } else if (Date.now() < root._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
"\n",
"\n",
" function run_callbacks() {\n",
" try {\n",
" root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" }\n",
" finally {\n",
" delete root._bokeh_onload_callbacks\n",
" }\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
"\n",
" function load_libs(js_urls, callback) {\n",
" root._bokeh_onload_callbacks.push(callback);\n",
" if (root._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" root._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" root._bokeh_is_loading--;\n",
" if (root._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"eaf280a4-3089-48d3-a944-2396a28397ea\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'eaf280a4-3089-48d3-a944-2396a28397ea' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
"\n",
" var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.15.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.15.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.15.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.15.min.js\"];\n",
"\n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" Bokeh.set_log_level(\"info\");\n",
" },\n",
" \n",
" function(Bokeh) {\n",
" \n",
" },\n",
" function(Bokeh) {\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.15.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.15.min.css\");\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.15.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.15.min.css\");\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.15.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.15.min.css\");\n",
" }\n",
" ];\n",
"\n",
" function run_inline_js() {\n",
" \n",
" if ((root.Bokeh !== undefined) || (force === true)) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i].call(root, root.Bokeh);\n",
" }if (force === true) {\n",
" display_loaded();\n",
" }} else if (Date.now() < root._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!root._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" root._bokeh_failed_load = true;\n",
" } else if (force !== true) {\n",
" var cell = $(document.getElementById(\"eaf280a4-3089-48d3-a944-2396a28397ea\")).parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
"\n",
" }\n",
"\n",
" if (root._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
"}(window));"
],
"application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n \n\n \n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n var NB_LOAD_WARNING = {'data': {'text/html':\n \"<div style='background-color: #fdd'>\\n\"+\n \"<p>\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"</p>\\n\"+\n \"<ul>\\n\"+\n \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n \"<li>use INLINE resources instead, as so:</li>\\n\"+\n \"</ul>\\n\"+\n \"<code>\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"</code>\\n\"+\n \"</div>\"}};\n\n function display_loaded() {\n var el = document.getElementById(\"eaf280a4-3089-48d3-a944-2396a28397ea\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n }\n finally {\n delete root._bokeh_onload_callbacks\n }\n console.info(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(js_urls, callback) {\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = js_urls.length;\n for (var i = 0; i < js_urls.length; i++) {\n var url = js_urls[i];\n var s = document.createElement('script');\n s.src = url;\n s.async = false;\n s.onreadystatechange = s.onload = function() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: all BokehJS libraries loaded\");\n run_callbacks()\n }\n };\n s.onerror = function() {\n console.warn(\"failed to load library \" + url);\n };\n console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n }\n };var element = document.getElementById(\"eaf280a4-3089-48d3-a944-2396a28397ea\");\n if (element == null) {\n console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'eaf280a4-3089-48d3-a944-2396a28397ea' but no matching script tag was found. \")\n return false;\n }\n\n var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.15.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.15.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.15.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.15.min.js\"];\n\n var inline_js = [\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n \n function(Bokeh) {\n \n },\n function(Bokeh) {\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.15.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.15.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.15.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.15.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.15.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.15.min.css\");\n }\n ];\n\n function run_inline_js() {\n \n if ((root.Bokeh !== undefined) || (force === true)) {\n for (var i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }if (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n var cell = $(document.getElementById(\"eaf280a4-3089-48d3-a944-2396a28397ea\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n\n }\n\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(js_urls, function() {\n console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<div style=\"display: table;\"><div style=\"display: table-row;\"><div style=\"display: table-cell;\"><b title=\"bokeh.models.renderers.GlyphRenderer\">GlyphRenderer</b>(</div><div style=\"display: table-cell;\">id&nbsp;=&nbsp;'06a8c00f-066a-4537-b390-d45ed98356df', <span id=\"2d977e3d-9772-4d8f-8b8c-df78edf67af6\" style=\"cursor: pointer;\">&hellip;)</span></div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">data_source&nbsp;=&nbsp;ColumnDataSource(id='1acaa109-219c-4ae3-8188-1ff4cf1d70b4', ...),</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">glyph&nbsp;=&nbsp;Line(id='177652a4-3ce0-4ec3-88a5-ac520ae828e8', ...),</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">hover_glyph&nbsp;=&nbsp;None,</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">js_event_callbacks&nbsp;=&nbsp;{},</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">js_property_callbacks&nbsp;=&nbsp;{},</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">level&nbsp;=&nbsp;'glyph',</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">muted&nbsp;=&nbsp;False,</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">muted_glyph&nbsp;=&nbsp;None,</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">name&nbsp;=&nbsp;None,</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">nonselection_glyph&nbsp;=&nbsp;Line(id='ccdd7663-569c-4994-99fa-dee05a072249', ...),</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">selection_glyph&nbsp;=&nbsp;None,</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">subscribed_events&nbsp;=&nbsp;[],</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">tags&nbsp;=&nbsp;[],</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">view&nbsp;=&nbsp;CDSView(id='c62fad52-dfd1-4363-a69d-235683cd6940', ...),</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">visible&nbsp;=&nbsp;True,</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">x_range_name&nbsp;=&nbsp;'default',</div></div><div class=\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\" style=\"display: none;\"><div style=\"display: table-cell;\"></div><div style=\"display: table-cell;\">y_range_name&nbsp;=&nbsp;'default')</div></div></div>\n",
"<script>\n",
"(function() {\n",
" var expanded = false;\n",
" var ellipsis = document.getElementById(\"2d977e3d-9772-4d8f-8b8c-df78edf67af6\");\n",
" ellipsis.addEventListener(\"click\", function() {\n",
" var rows = document.getElementsByClassName(\"2442a463-f3ba-49a9-b8ac-e550b95b4c44\");\n",
" for (var i = 0; i < rows.length; i++) {\n",
" var el = rows[i];\n",
" el.style.display = expanded ? \"none\" : \"table-row\";\n",
" }\n",
" ellipsis.innerHTML = expanded ? \"&hellip;)\" : \"&lsaquo;&lsaquo;&lsaquo;\";\n",
" expanded = !expanded;\n",
" });\n",
"})();\n",
"</script>\n"
],
"text/plain": [
"GlyphRenderer(id='06a8c00f-066a-4537-b390-d45ed98356df', ...)"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from bokeh.plotting import figure, output_file, show\n",
"bkh.output_notebook()\n",
"x = np.linspace(0., 1., 100)\n",
"y = np.cumsum(np.random.randn(100))\n",
"p = figure(title=\"example\", x_axis_label='x',y_axis_label='y')\n",
"p.line(x,y,line_width=5)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<div class=\"bk-root\">\n",
" <div class=\"bk-plotdiv\" id=\"e22e33e7-37fd-4576-9c45-ddf1a9a9ea16\"></div>\n",
"</div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"(function(root) {\n",
" function embed_document(root) {\n",
" \n",
" var docs_json = {\"0f8dbce0-e17b-403b-9e9c-93c540a10a4e\":{\"roots\":{\"references\":[{\"attributes\":{},\"id\":\"9481abdc-538a-4eaf-8d78-7332f9e1d285\",\"type\":\"LinearScale\"},{\"attributes\":{\"data_source\":{\"id\":\"1acaa109-219c-4ae3-8188-1ff4cf1d70b4\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"177652a4-3ce0-4ec3-88a5-ac520ae828e8\",\"type\":\"Line\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"ccdd7663-569c-4994-99fa-dee05a072249\",\"type\":\"Line\"},\"selection_glyph\":null,\"view\":{\"id\":\"c62fad52-dfd1-4363-a69d-235683cd6940\",\"type\":\"CDSView\"}},\"id\":\"06a8c00f-066a-4537-b390-d45ed98356df\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"1acaa109-219c-4ae3-8188-1ff4cf1d70b4\",\"type\":\"ColumnDataSource\"}},\"id\":\"c62fad52-dfd1-4363-a69d-235683cd6940\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"9e1d2aad-05f7-40c4-9c57-c996763f31d5\",\"type\":\"LinearScale\"},{\"attributes\":{\"callback\":null},\"id\":\"8d0c8330-6e1a-42f9-b185-0064abacf559\",\"type\":\"DataRange1d\"},{\"attributes\":{\"axis_label\":\"x\",\"formatter\":{\"id\":\"7add1105-e95c-455d-82cf-138bffd3b8ac\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"0b1fa944-d6a1-4fe6-ad33-c225ca0b3636\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"234d5aa4-2775-4bb2-bba3-5bc4d3accea0\",\"type\":\"BasicTicker\"}},\"id\":\"4bf33472-b090-43e6-b909-eea2da3c0a42\",\"type\":\"LinearAxis\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":5,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"ccdd7663-569c-4994-99fa-dee05a072249\",\"type\":\"Line\"},{\"attributes\":{\"callback\":null},\"id\":\"90ca1a75-08e2-4a57-bcc1-646d5e678ffd\",\"type\":\"DataRange1d\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":5,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"177652a4-3ce0-4ec3-88a5-ac520ae828e8\",\"type\":\"Line\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"0b1fa944-d6a1-4fe6-ad33-c225ca0b3636\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"3b4dfd90-02c0-4eed-83a0-7dd0795f8604\",\"type\":\"BasicTicker\"}},\"id\":\"073b1616-bf1b-4a12-9523-62ac8fa27171\",\"type\":\"Grid\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":{\"__ndarray__\":\"AAAAAAAAAABbv1Kg1q+EP1u/UqDWr5Q/CB988MEHnz9bv1Kg1q+kPzJvZ0jM26k/CB988MEHrz9wZ0jM2xmyP1u/UqDWr7Q/RhdddNFFtz8yb2dIzNu5Px3HcRzHcbw/CB988MEHvz96O0Ni3s7AP3BnSMzbGcI/ZZNNNtlkwz9bv1Kg1q/EP1HrVwrU+sU/RhdddNFFxz88Q2LezpDIPzJvZ0jM28k/J5tssskmyz8dx3Ecx3HMPxPzdobEvM0/CB988MEHzz9/pUCtXynQP3o7Q2LeztA/ddFFF1100T9wZ0jM2xnSP2r9SoFav9I/ZZNNNtlk0z9gKVDrVwrUP1u/UqDWr9Q/VlVVVVVV1T9R61cK1PrVP0yBWr9SoNY/RhdddNFF1z9BrV8pUOvXPzxDYt7OkNg/N9lkk0022T8yb2dIzNvZPy0Fav1Kgdo/J5tssskm2z8iMW9nSMzbPx3HcRzHcdw/GF100UUX3T8T83aGxLzdPw6JeTtDYt4/CB988MEH3z8DtX6lQK3fP3+lQK1fKeA/ffDBBx984D96O0Ni3s7gP3eGxLydIeE/ddFFF1104T9yHMdxHMfhP3BnSMzbGeI/bbLJJpts4j9q/UqBWr/iP2hIzNsZEuM/ZZNNNtlk4z9j3s6QmLfjP2ApUOtXCuQ/XnTRRRdd5D9bv1Kg1q/kP1gK1PqVAuU/VlVVVVVV5T9ToNavFKjlP1HrVwrU+uU/TjbZZJNN5j9MgVq/UqDmP0nM2xkS8+Y/RhdddNFF5z9EYt7OkJjnP0GtXylQ6+c/P/jggw8+6D88Q2LezpDoPzmO4ziO4+g/N9lkk0026T80JObtDInpPzJvZ0jM2+k/L7rooosu6j8tBWr9SoHqPypQ61cK1Oo/J5tssskm6z8l5u0MiXnrPyIxb2dIzOs/IHzwwQcf7D8dx3Ecx3HsPxsS83aGxOw/GF100UUX7T8VqPUrBWrtPxPzdobEvO0/ED744IMP7j8OiXk7Q2LuPwvU+pUCte4/CB988MEH7z8Gav1KgVrvPwO1fqVAre8/AAAAAAAA8D8=\",\"dtype\":\"float64\",\"shape\":[100]},\"y\":{\"__ndarray__\":\"pYxoTga39L/cKMK8Q8b9v7ycSphmBwPAVXVO1ygyBsBQeH8DhwYLwMo/XlQbFgjA7uc5tynCD8CC72ZSqkIWwMQ+3kv2OhTA3CABayy0FsBSiO7HZooTwKBu2w3V4BbAEp65XO+jEcBAR5AqaJgWwEAzG5UCaBvAt4+S7SefGMAAEJnWeYERwEzFuaLnsBTAjkv2aMfSDMCVWJt9aaYAwAHv8XFUqfS/I37nDxEj+L8Ccr3mfIoNwGci03UgChXAe7FAqTpHGMCSKS3fuEYWwBv6mVHgDBfAUnTRMwW1GcCtQBkkfV8ZwOLidrDbACDAyLz+4Xp8HsAsYjF9DighwOvsGhDHOx3AWkHVT6WhHMCnCTvoI7EfwLK1G0mG6yDAvBNF7oEkJMCG3TeDCNAjwMo0HvmM1SXA9yNpmaIQJsAI2QRz78gjwE1r+8rgGyPAR9ZOKWooIsByUBk6csIZwEQY84XA/hbA7YJpydiMEsDwvEAvt5QTwK10bKNeXRjA7/V4+253F8Cx1KHZ0h4cwCVJ632PFyTABxT1unLnIsB90m9ixj0iwB84clwOYyTA9HO/wdvOIcA28y03pfohwGwNzj+t7iLAyj6DPRncJMD+jpFfQo0iwDL8SNsHcSPA+OH16vd1JMDCHn47KmklwGoqpkpg/ibAy42Pu0BhKsBozoFwutwrwK0Kb7E0oy3ANOHFT64/LMAM5U/FYuIuwBQuHeDqhC3Aad/hQK+QLsBvJnB52xkwwJmw4/s+RzDAqTpr7ew+MMCdgEr//yQwwD4EbpkbIy/ASTFbEmW3LsASrYcnHeowwD7QR0OamzHAOv2pw2f3L8C0kp3RlxowwDURs3jUczLAM8FoGQNJMsBqnGw20pUwwJbrJoUq1S7A25JaRdW4LsCu/Y8zR0kuwJ14T22+/izASsP1BcZPLcC+bDXFDEouwHkxOj1nBivAULmNqtTTK8BFILXXCc8pwG3k7VO69izAOgxtcFmKLsCM+YCpOW0wwJ5WkCogBDDACl7BXTqmMMDhCMYF2UwxwOlqYa2pOTLAifimTwMVMsA=\",\"dtype\":\"float64\",\"shape\":[100]}},\"selected\":null,\"selection_policy\":null},\"id\":\"1acaa109-219c-4ae3-8188-1ff4cf1d70b4\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"plot\":{\"id\":\"0b1fa944-d6a1-4fe6-ad33-c225ca0b3636\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"234d5aa4-2775-4bb2-bba3-5bc4d3accea0\",\"type\":\"BasicTicker\"}},\"id\":\"6bef8b34-cbac-428c-bad2-a8bb77d5984d\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"234d5aa4-2775-4bb2-bba3-5bc4d3accea0\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis_label\":\"y\",\"formatter\":{\"id\":\"de4ed831-a92f-43a7-8739-205ae59b6d80\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"0b1fa944-d6a1-4fe6-ad33-c225ca0b3636\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"3b4dfd90-02c0-4eed-83a0-7dd0795f8604\",\"type\":\"BasicTicker\"}},\"id\":\"e344fd8c-fa79-4369-b7c5-83c70f3147f5\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"3b4dfd90-02c0-4eed-83a0-7dd0795f8604\",\"type\":\"BasicTicker\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"fe65dbf8-2c56-4a5c-b1b4-0d15c4b2b367\",\"type\":\"PanTool\"},{\"id\":\"00083873-8322-46d2-8d8d-bed2572674a7\",\"type\":\"WheelZoomTool\"},{\"id\":\"115277b4-5e41-457e-a5d6-c08a958550bf\",\"type\":\"BoxZoomTool\"},{\"id\":\"70250ea4-80c0-4354-b281-c1f4dfcb5900\",\"type\":\"SaveTool\"},{\"id\":\"2edf3ed2-0a2e-462e-b36d-00b9d901a56b\",\"type\":\"ResetTool\"},{\"id\":\"bb90bdd9-b6f5-4785-85f0-430eba48526d\",\"type\":\"HelpTool\"}]},\"id\":\"2ec0efb0-0474-4bf0-86b5-f4166e9ec381\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"fe65dbf8-2c56-4a5c-b1b4-0d15c4b2b367\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"00083873-8322-46d2-8d8d-bed2572674a7\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"7add1105-e95c-455d-82cf-138bffd3b8ac\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"overlay\":{\"id\":\"24e418c9-877b-4e57-9ea4-bd36e3afef39\",\"type\":\"BoxAnnotation\"}},\"id\":\"115277b4-5e41-457e-a5d6-c08a958550bf\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"70250ea4-80c0-4354-b281-c1f4dfcb5900\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"2edf3ed2-0a2e-462e-b36d-00b9d901a56b\",\"type\":\"ResetTool\"},{\"attributes\":{\"plot\":null,\"text\":\"example\"},\"id\":\"d9769fd8-7586-4508-bc7f-4b072a010164\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"de4ed831-a92f-43a7-8739-205ae59b6d80\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"bb90bdd9-b6f5-4785-85f0-430eba48526d\",\"type\":\"HelpTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"24e418c9-877b-4e57-9ea4-bd36e3afef39\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"below\":[{\"id\":\"4bf33472-b090-43e6-b909-eea2da3c0a42\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"e344fd8c-fa79-4369-b7c5-83c70f3147f5\",\"type\":\"LinearAxis\"}],\"renderers\":[{\"id\":\"4bf33472-b090-43e6-b909-eea2da3c0a42\",\"type\":\"LinearAxis\"},{\"id\":\"6bef8b34-cbac-428c-bad2-a8bb77d5984d\",\"type\":\"Grid\"},{\"id\":\"e344fd8c-fa79-4369-b7c5-83c70f3147f5\",\"type\":\"LinearAxis\"},{\"id\":\"073b1616-bf1b-4a12-9523-62ac8fa27171\",\"type\":\"Grid\"},{\"id\":\"24e418c9-877b-4e57-9ea4-bd36e3afef39\",\"type\":\"BoxAnnotation\"},{\"id\":\"06a8c00f-066a-4537-b390-d45ed98356df\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"d9769fd8-7586-4508-bc7f-4b072a010164\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"2ec0efb0-0474-4bf0-86b5-f4166e9ec381\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"8d0c8330-6e1a-42f9-b185-0064abacf559\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"9e1d2aad-05f7-40c4-9c57-c996763f31d5\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"90ca1a75-08e2-4a57-bcc1-646d5e678ffd\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"9481abdc-538a-4eaf-8d78-7332f9e1d285\",\"type\":\"LinearScale\"}},\"id\":\"0b1fa944-d6a1-4fe6-ad33-c225ca0b3636\",\"subtype\":\"Figure\",\"type\":\"Plot\"}],\"root_ids\":[\"0b1fa944-d6a1-4fe6-ad33-c225ca0b3636\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.15\"}};\n",
" var render_items = [{\"docid\":\"0f8dbce0-e17b-403b-9e9c-93c540a10a4e\",\"elementid\":\"e22e33e7-37fd-4576-9c45-ddf1a9a9ea16\",\"modelid\":\"0b1fa944-d6a1-4fe6-ad33-c225ca0b3636\"}];\n",
" root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
"\n",
" }\n",
" if (root.Bokeh !== undefined) {\n",
" embed_document(root);\n",
" } else {\n",
" var attempts = 0;\n",
" var timer = setInterval(function(root) {\n",
" if (root.Bokeh !== undefined) {\n",
" embed_document(root);\n",
" clearInterval(timer);\n",
" }\n",
" attempts++;\n",
" if (attempts > 100) {\n",
" console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\")\n",
" clearInterval(timer);\n",
" }\n",
" }, 10, root)\n",
" }\n",
"})(window);"
],
"application/vnd.bokehjs_exec.v0+json": ""
},
"metadata": {
"application/vnd.bokehjs_exec.v0+json": {
"id": "0b1fa944-d6a1-4fe6-ad33-c225ca0b3636"
}
},
"output_type": "display_data"
}
],
"source": [
"show(p)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<div class=\"bk-root\">\n",
" <div class=\"bk-plotdiv\" id=\"5c0170ff-c896-4b8a-9c73-4a3a8627fd0b\"></div>\n",
"</div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"(function(root) {\n",
" function embed_document(root) {\n",
" \n",
" var docs_json = {\"80344fff-6d41-40ee-a0ac-deb7e2cf401a\":{\"roots\":{\"references\":[{\"attributes\":{\"plot\":{\"id\":\"027fd811-b730-4191-96fe-4d9c7473216a\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"ebbf56fa-6179-439e-abaf-78f72b1d4bf4\",\"type\":\"BasicTicker\"}},\"id\":\"dd07e722-455e-458e-88e2-50e421cfc446\",\"type\":\"Grid\"},{\"attributes\":{\"formatter\":{\"id\":\"e0298d62-c911-4735-828c-4a2a5f77a509\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"027fd811-b730-4191-96fe-4d9c7473216a\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"ebbf56fa-6179-439e-abaf-78f72b1d4bf4\",\"type\":\"BasicTicker\"}},\"id\":\"35cac033-3f3a-42ad-adce-903f81e59e5f\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"91318dc9-d268-491f-835a-24da6bbd8c1a\",\"type\":\"SaveTool\"},{\"attributes\":{\"callback\":null},\"id\":\"929b9e6a-947b-48e2-a80f-a53e5b7ca9eb\",\"type\":\"DataRange1d\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"3a0626f0-7434-4cb6-b5bf-3ab166f4d23d\",\"type\":\"PanTool\"},{\"id\":\"efabc943-87dd-4cf0-b751-931c5541a59d\",\"type\":\"WheelZoomTool\"},{\"id\":\"3a8c8055-d332-4f5d-a84b-61aa89516fc4\",\"type\":\"BoxZoomTool\"},{\"id\":\"91318dc9-d268-491f-835a-24da6bbd8c1a\",\"type\":\"SaveTool\"},{\"id\":\"b8a66fc1-d475-45a4-b161-60960b981d65\",\"type\":\"ResetTool\"},{\"id\":\"a91865f0-1a54-4da6-9f56-6da8deb40486\",\"type\":\"HelpTool\"}]},\"id\":\"9fa557ab-6b02-4275-a417-cecee94b3816\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"b8a66fc1-d475-45a4-b161-60960b981d65\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"fdad5bae-06d6-4f1e-8e47-e740350ebc02\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\",\"fill_color\",\"line_color\"],\"data\":{\"fill_color\":[\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\"],\"line_color\":[\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\"],\"x\":{\"__ndarray__\":\"ZmZmZmZm9j9mZmZmZmb2P83MzMzMzPQ/AAAAAAAA+D9mZmZmZmb2PzMzMzMzM/s/ZmZmZmZm9j8AAAAAAAD4P2ZmZmZmZvY/AAAAAAAA+D8AAAAAAAD4P5qZmZmZmfk/ZmZmZmZm9j+amZmZmZnxPzMzMzMzM/M/AAAAAAAA+D/NzMzMzMz0P2ZmZmZmZvY/MzMzMzMz+z8AAAAAAAD4PzMzMzMzM/s/AAAAAAAA+D8AAAAAAADwPzMzMzMzM/s/ZmZmZmZm/j+amZmZmZn5P5qZmZmZmfk/AAAAAAAA+D9mZmZmZmb2P5qZmZmZmfk/mpmZmZmZ+T8AAAAAAAD4PwAAAAAAAPg/ZmZmZmZm9j8AAAAAAAD4PzMzMzMzM/M/zczMzMzM9D9mZmZmZmb2P83MzMzMzPQ/AAAAAAAA+D/NzMzMzMz0P83MzMzMzPQ/zczMzMzM9D+amZmZmZn5P2ZmZmZmZv4/ZmZmZmZm9j+amZmZmZn5P2ZmZmZmZvY/AAAAAAAA+D9mZmZmZmb2P83MzMzMzBJAAAAAAAAAEkCamZmZmZkTQAAAAAAAABBAZmZmZmZmEkAAAAAAAAASQM3MzMzMzBJAZmZmZmZmCkBmZmZmZmYSQDMzMzMzMw9AAAAAAAAADEDNzMzMzMwQQAAAAAAAABBAzczMzMzMEkDNzMzMzMwMQJqZmZmZmRFAAAAAAAAAEkBmZmZmZmYQQAAAAAAAABJAMzMzMzMzD0AzMzMzMzMTQAAAAAAAABBAmpmZmZmZE0DNzMzMzMwSQDMzMzMzMxFAmpmZmZmZEUAzMzMzMzMTQAAAAAAAABRAAAAAAAAAEkAAAAAAAAAMQGZmZmZmZg5AmpmZmZmZDUAzMzMzMzMPQGZmZmZmZhRAAAAAAAAAEkAAAAAAAAASQM3MzMzMzBJAmpmZmZmZEUBmZmZmZmYQQAAAAAAAABBAmpmZmZmZEUBmZmZmZmYSQAAAAAAAABBAZmZmZmZmCkDNzMzMzMwQQM3MzMzMzBBAzczMzMzMEEAzMzMzMzMRQAAAAAAAAAhAZmZmZmZmEEAAAAAAAAAYQGZmZmZmZhRAmpmZmZmZF0BmZmZmZmYWQDMzMzMzMxdAZmZmZmZmGkAAAAAAAAASQDMzMzMzMxlAMzMzMzMzF0BmZmZmZmYYQGZmZmZmZhRAMzMzMzMzFUAAAAAAAAAWQAAAAAAAABRAZmZmZmZmFEAzMzMzMzMVQAAAAAAAABZAzczMzMzMGkCamZmZmZkbQAAAAAAAABRAzczMzMzMFkCamZmZmZkTQM3MzMzMzBpAmpmZmZmZE0DNzMzMzMwWQAAAAAAAABhAMzMzMzMzE0CamZmZmZkTQGZmZmZmZhZAMzMzMzMzF0BmZmZmZmYYQJqZmZmZmRlAZmZmZmZmFkBmZmZmZmYUQGZmZmZmZhZAZmZmZmZmGEBmZmZmZmYWQAAAAAAAABZAMzMzMzMzE0CamZmZmZkVQGZmZmZmZhZAZmZmZmZmFEBmZmZmZmYUQJqZmZmZmRdAzczMzMzMFkDNzMzMzMwUQAAAAAAAABRAzczMzMzMFECamZmZmZkVQGZmZmZmZhRA\",\"dtype\":\"float64\",\"shape\":[150]},\"y\":{\"__ndarray__\":\"mpmZmZmZyT+amZmZmZnJP5qZmZmZmck/mpmZmZmZyT+amZmZmZnJP5qZmZmZmdk/MzMzMzMz0z+amZmZmZnJP5qZmZmZmck/mpmZmZmZuT+amZmZmZnJP5qZmZmZmck/mpmZmZmZuT+amZmZmZm5P5qZmZmZmck/mpmZmZmZ2T+amZmZmZnZPzMzMzMzM9M/MzMzMzMz0z8zMzMzMzPTP5qZmZmZmck/mpmZmZmZ2T+amZmZmZnJPwAAAAAAAOA/mpmZmZmZyT+amZmZmZnJP5qZmZmZmdk/mpmZmZmZyT+amZmZmZnJP5qZmZmZmck/mpmZmZmZyT+amZmZmZnZP5qZmZmZmbk/mpmZmZmZyT+amZmZmZnJP5qZmZmZmck/mpmZmZmZyT+amZmZmZm5P5qZmZmZmck/mpmZmZmZyT8zMzMzMzPTPzMzMzMzM9M/mpmZmZmZyT8zMzMzMzPjP5qZmZmZmdk/MzMzMzMz0z+amZmZmZnJP5qZmZmZmck/mpmZmZmZyT+amZmZmZnJP2ZmZmZmZvY/AAAAAAAA+D8AAAAAAAD4P83MzMzMzPQ/AAAAAAAA+D/NzMzMzMz0P5qZmZmZmfk/AAAAAAAA8D/NzMzMzMz0P2ZmZmZmZvY/AAAAAAAA8D8AAAAAAAD4PwAAAAAAAPA/ZmZmZmZm9j/NzMzMzMz0P2ZmZmZmZvY/AAAAAAAA+D8AAAAAAADwPwAAAAAAAPg/mpmZmZmZ8T/NzMzMzMz8P83MzMzMzPQ/AAAAAAAA+D8zMzMzMzPzP83MzMzMzPQ/ZmZmZmZm9j9mZmZmZmb2PzMzMzMzM/s/AAAAAAAA+D8AAAAAAADwP5qZmZmZmfE/AAAAAAAA8D8zMzMzMzPzP5qZmZmZmfk/AAAAAAAA+D+amZmZmZn5PwAAAAAAAPg/zczMzMzM9D/NzMzMzMz0P83MzMzMzPQ/MzMzMzMz8z9mZmZmZmb2PzMzMzMzM/M/AAAAAAAA8D/NzMzMzMz0PzMzMzMzM/M/zczMzMzM9D/NzMzMzMz0P5qZmZmZmfE/zczMzMzM9D8AAAAAAAAEQGZmZmZmZv4/zczMzMzMAEDNzMzMzMz8P5qZmZmZmQFAzczMzMzMAEAzMzMzMzP7P83MzMzMzPw/zczMzMzM/D8AAAAAAAAEQAAAAAAAAABAZmZmZmZm/j/NzMzMzMwAQAAAAAAAAABAMzMzMzMzA0BmZmZmZmYCQM3MzMzMzPw/mpmZmZmZAUBmZmZmZmYCQAAAAAAAAPg/ZmZmZmZmAkAAAAAAAAAAQAAAAAAAAABAzczMzMzM/D/NzMzMzMwAQM3MzMzMzPw/zczMzMzM/D/NzMzMzMz8P83MzMzMzABAmpmZmZmZ+T9mZmZmZmb+PwAAAAAAAABAmpmZmZmZAUAAAAAAAAD4P2ZmZmZmZvY/ZmZmZmZmAkAzMzMzMzMDQM3MzMzMzPw/zczMzMzM/D/NzMzMzMwAQDMzMzMzMwNAZmZmZmZmAkBmZmZmZmb+P2ZmZmZmZgJAAAAAAAAABEBmZmZmZmYCQGZmZmZmZv4/AAAAAAAAAEBmZmZmZmYCQM3MzMzMzPw/\",\"dtype\":\"float64\",\"shape\":[150]}},\"selected\":null,\"selection_policy\":null},\"id\":\"0e4d5a0d-68a8-4e9c-bec6-5cab7b5e49a6\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"703c7ddd-395c-4111-a12a-575a4d98e61b\",\"type\":\"LinearScale\"},{\"attributes\":{\"data_source\":{\"id\":\"0e4d5a0d-68a8-4e9c-bec6-5cab7b5e49a6\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"f1c1fcb7-38ad-40f0-b892-6a122f58dba7\",\"type\":\"Circle\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"7bf16c0a-d940-47fe-a446-11ec01880dd6\",\"type\":\"Circle\"},\"selection_glyph\":null,\"view\":{\"id\":\"b6c77d7e-8989-4830-ba9a-beb968cb8269\",\"type\":\"CDSView\"}},\"id\":\"9e58a850-ad32-4226-b9f3-abf469943c58\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"027fd811-b730-4191-96fe-4d9c7473216a\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"362ef6c3-536b-4eaf-90ad-479fc519c38f\",\"type\":\"BasicTicker\"}},\"id\":\"dddb3405-8e7c-489e-bf20-1f1b63968552\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"e0298d62-c911-4735-828c-4a2a5f77a509\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"units\":\"screen\",\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"7bf16c0a-d940-47fe-a446-11ec01880dd6\",\"type\":\"Circle\"},{\"attributes\":{\"source\":{\"id\":\"0e4d5a0d-68a8-4e9c-bec6-5cab7b5e49a6\",\"type\":\"ColumnDataSource\"}},\"id\":\"b6c77d7e-8989-4830-ba9a-beb968cb8269\",\"type\":\"CDSView\"},{\"attributes\":{\"below\":[{\"id\":\"35cac033-3f3a-42ad-adce-903f81e59e5f\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"db6f01e5-6f24-4834-ad75-1e82bc89b451\",\"type\":\"LinearAxis\"}],\"renderers\":[{\"id\":\"35cac033-3f3a-42ad-adce-903f81e59e5f\",\"type\":\"LinearAxis\"},{\"id\":\"dd07e722-455e-458e-88e2-50e421cfc446\",\"type\":\"Grid\"},{\"id\":\"db6f01e5-6f24-4834-ad75-1e82bc89b451\",\"type\":\"LinearAxis\"},{\"id\":\"dddb3405-8e7c-489e-bf20-1f1b63968552\",\"type\":\"Grid\"},{\"id\":\"a6104ddc-2a7a-4ab4-9362-ca32e8f5d53f\",\"type\":\"BoxAnnotation\"},{\"id\":\"9e58a850-ad32-4226-b9f3-abf469943c58\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"77d91949-5228-4b4e-aa26-57d6fab6dcee\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"9fa557ab-6b02-4275-a417-cecee94b3816\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"929b9e6a-947b-48e2-a80f-a53e5b7ca9eb\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"703c7ddd-395c-4111-a12a-575a4d98e61b\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"7430ef51-0b98-4698-9a63-6ddad46505f3\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"d7bca959-a52a-4043-be5d-9cdf332db158\",\"type\":\"LinearScale\"}},\"id\":\"027fd811-b730-4191-96fe-4d9c7473216a\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"a6104ddc-2a7a-4ab4-9362-ca32e8f5d53f\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"overlay\":{\"id\":\"a6104ddc-2a7a-4ab4-9362-ca32e8f5d53f\",\"type\":\"BoxAnnotation\"}},\"id\":\"3a8c8055-d332-4f5d-a84b-61aa89516fc4\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"a91865f0-1a54-4da6-9f56-6da8deb40486\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"362ef6c3-536b-4eaf-90ad-479fc519c38f\",\"type\":\"BasicTicker\"},{\"attributes\":{\"plot\":null,\"text\":\"iris example\"},\"id\":\"77d91949-5228-4b4e-aa26-57d6fab6dcee\",\"type\":\"Title\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.25},\"fill_color\":{\"field\":\"fill_color\"},\"line_color\":{\"field\":\"line_color\"},\"size\":{\"units\":\"screen\",\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"f1c1fcb7-38ad-40f0-b892-6a122f58dba7\",\"type\":\"Circle\"},{\"attributes\":{\"callback\":null},\"id\":\"7430ef51-0b98-4698-9a63-6ddad46505f3\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"3a0626f0-7434-4cb6-b5bf-3ab166f4d23d\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"efabc943-87dd-4cf0-b751-931c5541a59d\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"formatter\":{\"id\":\"fdad5bae-06d6-4f1e-8e47-e740350ebc02\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"027fd811-b730-4191-96fe-4d9c7473216a\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"362ef6c3-536b-4eaf-90ad-479fc519c38f\",\"type\":\"BasicTicker\"}},\"id\":\"db6f01e5-6f24-4834-ad75-1e82bc89b451\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"d7bca959-a52a-4043-be5d-9cdf332db158\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"ebbf56fa-6179-439e-abaf-78f72b1d4bf4\",\"type\":\"BasicTicker\"}],\"root_ids\":[\"027fd811-b730-4191-96fe-4d9c7473216a\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.15\"}};\n",
" var render_items = [{\"docid\":\"80344fff-6d41-40ee-a0ac-deb7e2cf401a\",\"elementid\":\"5c0170ff-c896-4b8a-9c73-4a3a8627fd0b\",\"modelid\":\"027fd811-b730-4191-96fe-4d9c7473216a\"}];\n",
" root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
"\n",
" }\n",
" if (root.Bokeh !== undefined) {\n",
" embed_document(root);\n",
" } else {\n",
" var attempts = 0;\n",
" var timer = setInterval(function(root) {\n",
" if (root.Bokeh !== undefined) {\n",
" embed_document(root);\n",
" clearInterval(timer);\n",
" }\n",
" attempts++;\n",
" if (attempts > 100) {\n",
" console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\")\n",
" clearInterval(timer);\n",
" }\n",
" }, 10, root)\n",
" }\n",
"})(window);"
],
"application/vnd.bokehjs_exec.v0+json": ""
},
"metadata": {
"application/vnd.bokehjs_exec.v0+json": {
"id": "027fd811-b730-4191-96fe-4d9c7473216a"
}
},
"output_type": "display_data"
}
],
"source": [
"from bokeh.sampledata.iris import flowers\n",
"colormap = {'setosa': 'red', 'versicolor': 'green',\n",
" 'virginica': 'blue'}\n",
"flowers['color'] = flowers['species'].map(lambda x: colormap[x])\n",
"k=figure(title=\"iris example\")\n",
"k.scatter(flowers[\"petal_length\"],\n",
" flowers[\"petal_width\"],\n",
" color=flowers[\"color\"],\n",
" fill_alpha=0.25, size=10,)\n",
"show(k)"
]
},
{
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment