daru 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +0 -0
  3. data/Gemfile +0 -1
  4. data/History.txt +35 -0
  5. data/README.md +178 -198
  6. data/daru.gemspec +5 -7
  7. data/lib/daru.rb +10 -2
  8. data/lib/daru/accessors/array_wrapper.rb +36 -198
  9. data/lib/daru/accessors/nmatrix_wrapper.rb +60 -209
  10. data/lib/daru/core/group_by.rb +183 -0
  11. data/lib/daru/dataframe.rb +615 -167
  12. data/lib/daru/index.rb +17 -16
  13. data/lib/daru/io/io.rb +5 -12
  14. data/lib/daru/maths/arithmetic/dataframe.rb +72 -8
  15. data/lib/daru/maths/arithmetic/vector.rb +19 -6
  16. data/lib/daru/maths/statistics/dataframe.rb +103 -2
  17. data/lib/daru/maths/statistics/vector.rb +102 -61
  18. data/lib/daru/monkeys.rb +8 -0
  19. data/lib/daru/multi_index.rb +199 -0
  20. data/lib/daru/plotting/dataframe.rb +24 -24
  21. data/lib/daru/plotting/vector.rb +14 -15
  22. data/lib/daru/vector.rb +402 -98
  23. data/lib/version.rb +1 -1
  24. data/notebooks/grouping_splitting_pivots.ipynb +529 -0
  25. data/notebooks/intro_with_music_data_.ipynb +104 -119
  26. data/spec/accessors/wrappers_spec.rb +36 -0
  27. data/spec/core/group_by_spec.rb +331 -0
  28. data/spec/dataframe_spec.rb +1237 -475
  29. data/spec/fixtures/sales-funnel.csv +18 -0
  30. data/spec/index_spec.rb +10 -21
  31. data/spec/io/io_spec.rb +4 -14
  32. data/spec/math/arithmetic/dataframe_spec.rb +66 -0
  33. data/spec/math/arithmetic/vector_spec.rb +45 -4
  34. data/spec/math/statistics/dataframe_spec.rb +91 -1
  35. data/spec/math/statistics/vector_spec.rb +32 -6
  36. data/spec/monkeys_spec.rb +10 -1
  37. data/spec/multi_index_spec.rb +216 -0
  38. data/spec/spec_helper.rb +1 -0
  39. data/spec/vector_spec.rb +505 -57
  40. metadata +21 -15
@@ -2,7 +2,7 @@
2
2
  "metadata": {
3
3
  "language": "ruby",
4
4
  "name": "",
5
- "signature": "sha256:794011062017b04876efde12342e70893e5949f7c6324687b38447382892e1df"
5
+ "signature": "sha256:addeb041adfc32646a8288884b7c282421a0dd0465fcc24cfd498525d636ee08"
6
6
  },
7
7
  "nbformat": 3,
8
8
  "nbformat_minor": 0,
@@ -37,7 +37,7 @@
37
37
  "\n",
38
38
  "\tvar script = d3.select(\"head\")\n",
39
39
  "\t .append(\"script\")\n",
40
- "\t .attr(\"src\", \"https://rawgit.com/domitry/Nyaplotjs/master/release/nyaplot.js\")\n",
40
+ "\t .attr(\"src\", \"http://cdn.rawgit.com/domitry/Nyaplotjs/master/release/nyaplot.js\")\n",
41
41
  "\t .attr(\"async\", true);\n",
42
42
  "\n",
43
43
  "\tscript[0][0].onload = script[0][0].onreadystatechange = function(){\n",
@@ -59,35 +59,35 @@
59
59
  "output_type": "pyout",
60
60
  "prompt_number": 1,
61
61
  "text": [
62
- "\"if(window['d3'] === undefined ||\\n window['Nyaplot'] === undefined){\\n var path = {\\\"d3\\\":\\\"http://d3js.org/d3.v3.min\\\"};\\n\\n\\n\\n var shim = {\\\"d3\\\":{\\\"exports\\\":\\\"d3\\\"}};\\n\\n require.config({paths: path, shim:shim});\\n\\n\\nrequire(['d3'], function(d3){window['d3']=d3;console.log('finished loading d3');\\n\\n\\tvar script = d3.select(\\\"head\\\")\\n\\t .append(\\\"script\\\")\\n\\t .attr(\\\"src\\\", \\\"https://rawgit.com/domitry/Nyaplotjs/master/release/nyaplot.js\\\")\\n\\t .attr(\\\"async\\\", true);\\n\\n\\tscript[0][0].onload = script[0][0].onreadystatechange = function(){\\n\\n\\n\\t var event = document.createEvent(\\\"HTMLEvents\\\");\\n\\t event.initEvent(\\\"load_nyaplot\\\",false,false);\\n\\t window.dispatchEvent(event);\\n\\t console.log('Finished loading Nyaplotjs');\\n\\n\\t};\\n\\n\\n});\\n}\\n\""
62
+ "\"if(window['d3'] === undefined ||\\n window['Nyaplot'] === undefined){\\n var path = {\\\"d3\\\":\\\"http://d3js.org/d3.v3.min\\\"};\\n\\n\\n\\n var shim = {\\\"d3\\\":{\\\"exports\\\":\\\"d3\\\"}};\\n\\n require.config({paths: path, shim:shim});\\n\\n\\nrequire(['d3'], function(d3){window['d3']=d3;console.log('finished loading d3');\\n\\n\\tvar script = d3.select(\\\"head\\\")\\n\\t .append(\\\"script\\\")\\n\\t .attr(\\\"src\\\", \\\"http://cdn.rawgit.com/domitry/Nyaplotjs/master/release/nyaplot.js\\\")\\n\\t .attr(\\\"async\\\", true);\\n\\n\\tscript[0][0].onload = script[0][0].onreadystatechange = function(){\\n\\n\\n\\t var event = document.createEvent(\\\"HTMLEvents\\\");\\n\\t event.initEvent(\\\"load_nyaplot\\\",false,false);\\n\\t window.dispatchEvent(event);\\n\\t console.log('Finished loading Nyaplotjs');\\n\\n\\t};\\n\\n\\n});\\n}\\n\""
63
63
  ]
64
64
  },
65
65
  {
66
66
  "html": [
67
- "<table><tr><th></th><th>userid</th><th>timestamp</th><th>artid</th><th>artname</th><th>traid</th><th>traname</th></tr><tr><td>0</td><td>user_000705</td><td>2009-05-03T12:55:00Z</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>0138547f-374d-49d4-8f1c-9b2c8b5c65c0</td><td>X-Ray Eyes</td></tr><tr><td>1</td><td>user_000705</td><td>2009-05-03T12:51:28Z</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>22ce9a32-3510-4c8e-8151-c044a62eb4fd</td><td>Hard Times</td></tr><tr><td>2</td><td>user_000705</td><td>2009-05-03T12:46:55Z</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>22ce9a32-3510-4c8e-8151-c044a62eb4fd</td><td>Hard Times</td></tr><tr><td>3</td><td>user_000705</td><td>2009-05-03T12:42:17Z</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>c386b85f-1bfe-4038-b323-cb8229ab2f8b</td><td>Magic Touch</td></tr><tr><td>4</td><td>user_000705</td><td>2009-05-03T12:37:53Z</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>8ec9b4f8-2d1b-4616-9ae4-4711ca328fc3</td><td>Charisma</td></tr><tr><td>5</td><td>user_000705</td><td>2009-05-03T12:33:37Z</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>ff47d82e-313d-4bd0-8e61-fe61124a361b</td><td>Dirty Livin'</td></tr><tr><td>6</td><td>user_000705</td><td>2009-05-03T12:29:39Z</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>3621800b-87b7-43c6-b6a3-47ea4b658407</td><td>Sure Know Something</td></tr><tr><td>7</td><td>user_000705</td><td>2009-05-03T12:24:46Z</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>91cc5010-e65b-4f49-94b5-1deed61cfcc7</td><td>2,000 Man</td></tr><tr><td>8</td><td>user_000705</td><td>2009-05-03T12:20:17Z</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>daa13e72-9056-476f-b431-335b2c26842d</td><td>I Was Made For Lovin' You</td></tr><tr><td>9</td><td>user_000705</td><td>2009-05-03T12:16:20Z</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>1895c79d-ae5f-40bf-bc18-83fdcd8d2842</td><td>Burning Of The Midnight Lamp</td></tr><tr><td>10</td><td>user_000705</td><td>2009-05-03T12:12:35Z</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>1ae3c250-7b16-49d4-9c71-0928724eecce</td><td>Gypsy Eyes</td></tr><tr><td>11</td><td>user_000705</td><td>2009-05-03T12:08:26Z</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>fca63fe0-c9e6-4347-92b7-21f6cf79226c</td><td>Come On, Part 1</td></tr><tr><td>12</td><td>user_000705</td><td>2009-05-03T12:04:59Z</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>36beb31d-ed74-4a49-832f-a4a38dc96bab</td><td>Long Hot Summer Night</td></tr><tr><td>13</td><td>user_000705</td><td>2009-05-03T12:02:08Z</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>4ad6064e-7d54-49a2-a134-320a1612ee27</td><td>Little Miss Strange</td></tr><tr><td>14</td><td>user_000705</td><td>2009-05-03T11:47:07Z</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>40ffef8e-b851-473a-a239-08685eab22b0</td><td>Voodoo Chile</td></tr><tr><td>15</td><td>user_000705</td><td>2009-05-03T11:44:43Z</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>feb64d01-6e05-4974-bb44-0046deca1bdb</td><td>Crosstown Traffic</td></tr><tr><td>16</td><td>user_000705</td><td>2009-05-03T11:42:35Z</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>7f9b462a-8ac5-472d-a5aa-716b3b3d169c</td><td>Have You Ever Been (To Electric Ladyland)</td></tr><tr><td>17</td><td>user_000705</td><td>2009-05-03T11:41:13Z</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>88b57468-8d58-4310-b135-c94620fcfbc1</td><td>...And The Gods Made Love</td></tr><tr><td>18</td><td>user_000705</td><td>2009-05-02T09:24:28Z</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>788878e0-8965-489e-86e3-add4c1f3d134</td><td>Line Of Best Fit</td></tr><tr><td>19</td><td>user_000705</td><td>2009-05-02T09:19:58Z</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>7cfc403d-18e7-4b8e-b0c4-1864ca393fbb</td><td>Fake Frowns</td></tr><tr><td>20</td><td>user_000705</td><td>2009-05-02T09:15:03Z</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>34a2d7ad-6b3a-4cfc-b4ca-edfc55a6685b</td><td>Amputations</td></tr><tr><td>21</td><td>user_000705</td><td>2009-05-02T09:11:21Z</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>99db2ed6-4493-481c-ac20-54ad323cb04b</td><td>The Face That Launched 1000 Shits</td></tr><tr><td>22</td><td>user_000705</td><td>2009-05-02T09:07:44Z</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>269084ba-3065-4b43-a733-f491e618b26a</td><td>Sleep Spent</td></tr><tr><td>23</td><td>user_000705</td><td>2009-05-02T09:03:54Z</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>96fac269-5308-4aee-827f-d01a66674694</td><td>Pictures In An Exhibition</td></tr><tr><td>24</td><td>user_000705</td><td>2009-05-02T08:59:34Z</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>c29440d9-03e6-4e18-91d6-ef8bf1e1ca32</td><td>Your Bruise</td></tr><tr><td>25</td><td>user_000705</td><td>2009-05-02T08:56:55Z</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>ed55b695-976e-4898-8fde-51a8e3b0e262</td><td>Champagne From A Paper Cup</td></tr><tr><td>26</td><td>user_000705</td><td>2009-05-02T08:49:07Z</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>c5238d6d-9b04-496c-8674-4ea7a07aecd6</td><td>President Of What?</td></tr><tr><td>27</td><td>user_000705</td><td>2009-05-02T08:44:34Z</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>bf59dfef-03a8-4270-9456-50df79da56c2</td><td>Bend To Squares</td></tr><tr><td>28</td><td>user_000705</td><td>2009-05-01T19:08:37Z</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>788878e0-8965-489e-86e3-add4c1f3d134</td><td>Line Of Best Fit</td></tr><tr><td>29</td><td>user_000705</td><td>2009-05-01T19:04:07Z</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>7cfc403d-18e7-4b8e-b0c4-1864ca393fbb</td><td>Fake Frowns</td></tr><tr><td>30</td><td>user_000705</td><td>2009-05-01T18:59:12Z</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>34a2d7ad-6b3a-4cfc-b4ca-edfc55a6685b</td><td>Amputations</td></tr><tr><td>31</td><td>user_000705</td><td>2009-05-01T18:55:30Z</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>99db2ed6-4493-481c-ac20-54ad323cb04b</td><td>The Face That Launched 1000 Shits</td></tr><tr><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td></tr></table>"
67
+ "<table><tr><th></th><th>artid</th><th>artname</th><th>timestamp</th><th>traid</th><th>traname</th><th>userid</th></tr><tr><td>0</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03T12:55:00Z</td><td>0138547f-374d-49d4-8f1c-9b2c8b5c65c0</td><td>X-Ray Eyes</td><td>user_000705</td></tr><tr><td>1</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03T12:51:28Z</td><td>22ce9a32-3510-4c8e-8151-c044a62eb4fd</td><td>Hard Times</td><td>user_000705</td></tr><tr><td>2</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03T12:46:55Z</td><td>22ce9a32-3510-4c8e-8151-c044a62eb4fd</td><td>Hard Times</td><td>user_000705</td></tr><tr><td>3</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03T12:42:17Z</td><td>c386b85f-1bfe-4038-b323-cb8229ab2f8b</td><td>Magic Touch</td><td>user_000705</td></tr><tr><td>4</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03T12:37:53Z</td><td>8ec9b4f8-2d1b-4616-9ae4-4711ca328fc3</td><td>Charisma</td><td>user_000705</td></tr><tr><td>5</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03T12:33:37Z</td><td>ff47d82e-313d-4bd0-8e61-fe61124a361b</td><td>Dirty Livin'</td><td>user_000705</td></tr><tr><td>6</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03T12:29:39Z</td><td>3621800b-87b7-43c6-b6a3-47ea4b658407</td><td>Sure Know Something</td><td>user_000705</td></tr><tr><td>7</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03T12:24:46Z</td><td>91cc5010-e65b-4f49-94b5-1deed61cfcc7</td><td>2,000 Man</td><td>user_000705</td></tr><tr><td>8</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03T12:20:17Z</td><td>daa13e72-9056-476f-b431-335b2c26842d</td><td>I Was Made For Lovin' You</td><td>user_000705</td></tr><tr><td>9</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03T12:16:20Z</td><td>1895c79d-ae5f-40bf-bc18-83fdcd8d2842</td><td>Burning Of The Midnight Lamp</td><td>user_000705</td></tr><tr><td>10</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03T12:12:35Z</td><td>1ae3c250-7b16-49d4-9c71-0928724eecce</td><td>Gypsy Eyes</td><td>user_000705</td></tr><tr><td>11</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03T12:08:26Z</td><td>fca63fe0-c9e6-4347-92b7-21f6cf79226c</td><td>Come On, Part 1</td><td>user_000705</td></tr><tr><td>12</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03T12:04:59Z</td><td>36beb31d-ed74-4a49-832f-a4a38dc96bab</td><td>Long Hot Summer Night</td><td>user_000705</td></tr><tr><td>13</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03T12:02:08Z</td><td>4ad6064e-7d54-49a2-a134-320a1612ee27</td><td>Little Miss Strange</td><td>user_000705</td></tr><tr><td>14</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03T11:47:07Z</td><td>40ffef8e-b851-473a-a239-08685eab22b0</td><td>Voodoo Chile</td><td>user_000705</td></tr><tr><td>15</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03T11:44:43Z</td><td>feb64d01-6e05-4974-bb44-0046deca1bdb</td><td>Crosstown Traffic</td><td>user_000705</td></tr><tr><td>16</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03T11:42:35Z</td><td>7f9b462a-8ac5-472d-a5aa-716b3b3d169c</td><td>Have You Ever Been (To Electric Ladyland)</td><td>user_000705</td></tr><tr><td>17</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03T11:41:13Z</td><td>88b57468-8d58-4310-b135-c94620fcfbc1</td><td>...And The Gods Made Love</td><td>user_000705</td></tr><tr><td>18</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02T09:24:28Z</td><td>788878e0-8965-489e-86e3-add4c1f3d134</td><td>Line Of Best Fit</td><td>user_000705</td></tr><tr><td>19</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02T09:19:58Z</td><td>7cfc403d-18e7-4b8e-b0c4-1864ca393fbb</td><td>Fake Frowns</td><td>user_000705</td></tr><tr><td>20</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02T09:15:03Z</td><td>34a2d7ad-6b3a-4cfc-b4ca-edfc55a6685b</td><td>Amputations</td><td>user_000705</td></tr><tr><td>21</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02T09:11:21Z</td><td>99db2ed6-4493-481c-ac20-54ad323cb04b</td><td>The Face That Launched 1000 Shits</td><td>user_000705</td></tr><tr><td>22</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02T09:07:44Z</td><td>269084ba-3065-4b43-a733-f491e618b26a</td><td>Sleep Spent</td><td>user_000705</td></tr><tr><td>23</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02T09:03:54Z</td><td>96fac269-5308-4aee-827f-d01a66674694</td><td>Pictures In An Exhibition</td><td>user_000705</td></tr><tr><td>24</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02T08:59:34Z</td><td>c29440d9-03e6-4e18-91d6-ef8bf1e1ca32</td><td>Your Bruise</td><td>user_000705</td></tr><tr><td>25</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02T08:56:55Z</td><td>ed55b695-976e-4898-8fde-51a8e3b0e262</td><td>Champagne From A Paper Cup</td><td>user_000705</td></tr><tr><td>26</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02T08:49:07Z</td><td>c5238d6d-9b04-496c-8674-4ea7a07aecd6</td><td>President Of What?</td><td>user_000705</td></tr><tr><td>27</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02T08:44:34Z</td><td>bf59dfef-03a8-4270-9456-50df79da56c2</td><td>Bend To Squares</td><td>user_000705</td></tr><tr><td>28</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-01T19:08:37Z</td><td>788878e0-8965-489e-86e3-add4c1f3d134</td><td>Line Of Best Fit</td><td>user_000705</td></tr><tr><td>29</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-01T19:04:07Z</td><td>7cfc403d-18e7-4b8e-b0c4-1864ca393fbb</td><td>Fake Frowns</td><td>user_000705</td></tr><tr><td>30</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-01T18:59:12Z</td><td>34a2d7ad-6b3a-4cfc-b4ca-edfc55a6685b</td><td>Amputations</td><td>user_000705</td></tr><tr><td>31</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-01T18:55:30Z</td><td>99db2ed6-4493-481c-ac20-54ad323cb04b</td><td>The Face That Launched 1000 Shits</td><td>user_000705</td></tr><tr><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td></tr></table>"
68
68
  ],
69
69
  "metadata": {},
70
70
  "output_type": "pyout",
71
71
  "prompt_number": 1,
72
72
  "text": [
73
73
  "\n",
74
- "#<Daru::DataFrame:89549790 @name = 59f7207f-059f-4bb8-8315-2c7625c19dd2 @size = 2500>\n",
75
- " userid timestamp artid artname traid traname \n",
76
- " 0 user_00070 2009-05-03 e1f1e33e-2 Kiss 0138547f-3 X-Ray Eyes \n",
77
- " 1 user_00070 2009-05-03 e1f1e33e-2 Kiss 22ce9a32-3 Hard Times \n",
78
- " 2 user_00070 2009-05-03 e1f1e33e-2 Kiss 22ce9a32-3 Hard Times \n",
79
- " 3 user_00070 2009-05-03 e1f1e33e-2 Kiss c386b85f-1 Magic Touc \n",
80
- " 4 user_00070 2009-05-03 e1f1e33e-2 Kiss 8ec9b4f8-2 Charisma \n",
81
- " 5 user_00070 2009-05-03 e1f1e33e-2 Kiss ff47d82e-3 Dirty Livi \n",
82
- " 6 user_00070 2009-05-03 e1f1e33e-2 Kiss 3621800b-8 Sure Know \n",
83
- " 7 user_00070 2009-05-03 e1f1e33e-2 Kiss 91cc5010-e 2,000 Man \n",
84
- " 8 user_00070 2009-05-03 e1f1e33e-2 Kiss daa13e72-9 I Was Made \n",
85
- " 9 user_00070 2009-05-03 33b3c323-7 The Jimi H 1895c79d-a Burning Of \n",
86
- " 10 user_00070 2009-05-03 33b3c323-7 The Jimi H 1ae3c250-7 Gypsy Eyes \n",
87
- " 11 user_00070 2009-05-03 33b3c323-7 The Jimi H fca63fe0-c Come On, P \n",
88
- " 12 user_00070 2009-05-03 33b3c323-7 The Jimi H 36beb31d-e Long Hot S \n",
89
- " 13 user_00070 2009-05-03 33b3c323-7 The Jimi H 4ad6064e-7 Little Mis \n",
90
- " 14 user_00070 2009-05-03 33b3c323-7 The Jimi H 40ffef8e-b Voodoo Chi \n",
74
+ "#<Daru::DataFrame:86461610 @name = ae5b6be9-f08c-4e79-a0f3-ead8016fd7ee @size = 2500>\n",
75
+ " artid artname timestamp traid traname userid \n",
76
+ " 0 e1f1e33e-2 Kiss 2009-05-03 0138547f-3 X-Ray Eyes user_00070 \n",
77
+ " 1 e1f1e33e-2 Kiss 2009-05-03 22ce9a32-3 Hard Times user_00070 \n",
78
+ " 2 e1f1e33e-2 Kiss 2009-05-03 22ce9a32-3 Hard Times user_00070 \n",
79
+ " 3 e1f1e33e-2 Kiss 2009-05-03 c386b85f-1 Magic Touc user_00070 \n",
80
+ " 4 e1f1e33e-2 Kiss 2009-05-03 8ec9b4f8-2 Charisma user_00070 \n",
81
+ " 5 e1f1e33e-2 Kiss 2009-05-03 ff47d82e-3 Dirty Livi user_00070 \n",
82
+ " 6 e1f1e33e-2 Kiss 2009-05-03 3621800b-8 Sure Know user_00070 \n",
83
+ " 7 e1f1e33e-2 Kiss 2009-05-03 91cc5010-e 2,000 Man user_00070 \n",
84
+ " 8 e1f1e33e-2 Kiss 2009-05-03 daa13e72-9 I Was Made user_00070 \n",
85
+ " 9 33b3c323-7 The Jimi H 2009-05-03 1895c79d-a Burning Of user_00070 \n",
86
+ " 10 33b3c323-7 The Jimi H 2009-05-03 1ae3c250-7 Gypsy Eyes user_00070 \n",
87
+ " 11 33b3c323-7 The Jimi H 2009-05-03 fca63fe0-c Come On, P user_00070 \n",
88
+ " 12 33b3c323-7 The Jimi H 2009-05-03 36beb31d-e Long Hot S user_00070 \n",
89
+ " 13 33b3c323-7 The Jimi H 2009-05-03 4ad6064e-7 Little Mis user_00070 \n",
90
+ " 14 33b3c323-7 The Jimi H 2009-05-03 40ffef8e-b Voodoo Chi user_00070 \n",
91
91
  " ... ... ... ... ... ... ... \n"
92
92
  ]
93
93
  }
@@ -112,26 +112,26 @@
112
112
  "prompt_number": 2,
113
113
  "text": [
114
114
  "\n",
115
- "#<Daru::Vector:89548390 @name = timestamp @size = 2500 >\n",
116
- " timestamp\n",
117
- " 0 2009-05-03\n",
118
- " 1 2009-05-03\n",
119
- " 2 2009-05-03\n",
120
- " 3 2009-05-03\n",
121
- " 4 2009-05-03\n",
122
- " 5 2009-05-03\n",
123
- " 6 2009-05-03\n",
124
- " 7 2009-05-03\n",
125
- " 8 2009-05-03\n",
126
- " 9 2009-05-03\n",
127
- " 10 2009-05-03\n",
128
- " 11 2009-05-03\n",
129
- " 12 2009-05-03\n",
130
- " 13 2009-05-03\n",
131
- " 14 2009-05-03\n",
132
- " 15 2009-05-03\n",
133
- " 16 2009-05-03\n",
134
- " ... ...\n"
115
+ "#<Daru::Vector:85988150 @name = timestamp @size = 2500 >\n",
116
+ " timestamp\n",
117
+ " 0 2009-05-03T12:55:00Z\n",
118
+ " 1 2009-05-03T12:51:28Z\n",
119
+ " 2 2009-05-03T12:46:55Z\n",
120
+ " 3 2009-05-03T12:42:17Z\n",
121
+ " 4 2009-05-03T12:37:53Z\n",
122
+ " 5 2009-05-03T12:33:37Z\n",
123
+ " 6 2009-05-03T12:29:39Z\n",
124
+ " 7 2009-05-03T12:24:46Z\n",
125
+ " 8 2009-05-03T12:20:17Z\n",
126
+ " 9 2009-05-03T12:16:20Z\n",
127
+ " 10 2009-05-03T12:12:35Z\n",
128
+ " 11 2009-05-03T12:08:26Z\n",
129
+ " 12 2009-05-03T12:04:59Z\n",
130
+ " 13 2009-05-03T12:02:08Z\n",
131
+ " 14 2009-05-03T11:47:07Z\n",
132
+ " 15 2009-05-03T11:44:43Z\n",
133
+ " 16 2009-05-03T11:42:35Z\n",
134
+ " ... ...\n"
135
135
  ]
136
136
  }
137
137
  ],
@@ -152,30 +152,30 @@
152
152
  "outputs": [
153
153
  {
154
154
  "html": [
155
- "<table><tr><th></th><th>userid</th><th>timestamp</th><th>artid</th><th>artname</th><th>traid</th><th>traname</th></tr><tr><td>0</td><td>user_000705</td><td>2009-05-03 12:55:00 +0530</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>0138547f-374d-49d4-8f1c-9b2c8b5c65c0</td><td>X-Ray Eyes</td></tr><tr><td>1</td><td>user_000705</td><td>2009-05-03 12:51:28 +0530</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>22ce9a32-3510-4c8e-8151-c044a62eb4fd</td><td>Hard Times</td></tr><tr><td>2</td><td>user_000705</td><td>2009-05-03 12:46:55 +0530</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>22ce9a32-3510-4c8e-8151-c044a62eb4fd</td><td>Hard Times</td></tr><tr><td>3</td><td>user_000705</td><td>2009-05-03 12:42:17 +0530</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>c386b85f-1bfe-4038-b323-cb8229ab2f8b</td><td>Magic Touch</td></tr><tr><td>4</td><td>user_000705</td><td>2009-05-03 12:37:53 +0530</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>8ec9b4f8-2d1b-4616-9ae4-4711ca328fc3</td><td>Charisma</td></tr><tr><td>5</td><td>user_000705</td><td>2009-05-03 12:33:37 +0530</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>ff47d82e-313d-4bd0-8e61-fe61124a361b</td><td>Dirty Livin'</td></tr><tr><td>6</td><td>user_000705</td><td>2009-05-03 12:29:39 +0530</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>3621800b-87b7-43c6-b6a3-47ea4b658407</td><td>Sure Know Something</td></tr><tr><td>7</td><td>user_000705</td><td>2009-05-03 12:24:46 +0530</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>91cc5010-e65b-4f49-94b5-1deed61cfcc7</td><td>2,000 Man</td></tr><tr><td>8</td><td>user_000705</td><td>2009-05-03 12:20:17 +0530</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>daa13e72-9056-476f-b431-335b2c26842d</td><td>I Was Made For Lovin' You</td></tr><tr><td>9</td><td>user_000705</td><td>2009-05-03 12:16:20 +0530</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>1895c79d-ae5f-40bf-bc18-83fdcd8d2842</td><td>Burning Of The Midnight Lamp</td></tr><tr><td>10</td><td>user_000705</td><td>2009-05-03 12:12:35 +0530</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>1ae3c250-7b16-49d4-9c71-0928724eecce</td><td>Gypsy Eyes</td></tr><tr><td>11</td><td>user_000705</td><td>2009-05-03 12:08:26 +0530</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>fca63fe0-c9e6-4347-92b7-21f6cf79226c</td><td>Come On, Part 1</td></tr><tr><td>12</td><td>user_000705</td><td>2009-05-03 12:04:59 +0530</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>36beb31d-ed74-4a49-832f-a4a38dc96bab</td><td>Long Hot Summer Night</td></tr><tr><td>13</td><td>user_000705</td><td>2009-05-03 12:02:08 +0530</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>4ad6064e-7d54-49a2-a134-320a1612ee27</td><td>Little Miss Strange</td></tr><tr><td>14</td><td>user_000705</td><td>2009-05-03 11:47:07 +0530</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>40ffef8e-b851-473a-a239-08685eab22b0</td><td>Voodoo Chile</td></tr><tr><td>15</td><td>user_000705</td><td>2009-05-03 11:44:43 +0530</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>feb64d01-6e05-4974-bb44-0046deca1bdb</td><td>Crosstown Traffic</td></tr><tr><td>16</td><td>user_000705</td><td>2009-05-03 11:42:35 +0530</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>7f9b462a-8ac5-472d-a5aa-716b3b3d169c</td><td>Have You Ever Been (To Electric Ladyland)</td></tr><tr><td>17</td><td>user_000705</td><td>2009-05-03 11:41:13 +0530</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>88b57468-8d58-4310-b135-c94620fcfbc1</td><td>...And The Gods Made Love</td></tr><tr><td>18</td><td>user_000705</td><td>2009-05-02 09:24:28 +0530</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>788878e0-8965-489e-86e3-add4c1f3d134</td><td>Line Of Best Fit</td></tr><tr><td>19</td><td>user_000705</td><td>2009-05-02 09:19:58 +0530</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>7cfc403d-18e7-4b8e-b0c4-1864ca393fbb</td><td>Fake Frowns</td></tr><tr><td>20</td><td>user_000705</td><td>2009-05-02 09:15:03 +0530</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>34a2d7ad-6b3a-4cfc-b4ca-edfc55a6685b</td><td>Amputations</td></tr><tr><td>21</td><td>user_000705</td><td>2009-05-02 09:11:21 +0530</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>99db2ed6-4493-481c-ac20-54ad323cb04b</td><td>The Face That Launched 1000 Shits</td></tr><tr><td>22</td><td>user_000705</td><td>2009-05-02 09:07:44 +0530</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>269084ba-3065-4b43-a733-f491e618b26a</td><td>Sleep Spent</td></tr><tr><td>23</td><td>user_000705</td><td>2009-05-02 09:03:54 +0530</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>96fac269-5308-4aee-827f-d01a66674694</td><td>Pictures In An Exhibition</td></tr><tr><td>24</td><td>user_000705</td><td>2009-05-02 08:59:34 +0530</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>c29440d9-03e6-4e18-91d6-ef8bf1e1ca32</td><td>Your Bruise</td></tr><tr><td>25</td><td>user_000705</td><td>2009-05-02 08:56:55 +0530</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>ed55b695-976e-4898-8fde-51a8e3b0e262</td><td>Champagne From A Paper Cup</td></tr><tr><td>26</td><td>user_000705</td><td>2009-05-02 08:49:07 +0530</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>c5238d6d-9b04-496c-8674-4ea7a07aecd6</td><td>President Of What?</td></tr><tr><td>27</td><td>user_000705</td><td>2009-05-02 08:44:34 +0530</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>bf59dfef-03a8-4270-9456-50df79da56c2</td><td>Bend To Squares</td></tr><tr><td>28</td><td>user_000705</td><td>2009-05-01 19:08:37 +0530</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>788878e0-8965-489e-86e3-add4c1f3d134</td><td>Line Of Best Fit</td></tr><tr><td>29</td><td>user_000705</td><td>2009-05-01 19:04:07 +0530</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>7cfc403d-18e7-4b8e-b0c4-1864ca393fbb</td><td>Fake Frowns</td></tr><tr><td>30</td><td>user_000705</td><td>2009-05-01 18:59:12 +0530</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>34a2d7ad-6b3a-4cfc-b4ca-edfc55a6685b</td><td>Amputations</td></tr><tr><td>31</td><td>user_000705</td><td>2009-05-01 18:55:30 +0530</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>99db2ed6-4493-481c-ac20-54ad323cb04b</td><td>The Face That Launched 1000 Shits</td></tr><tr><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td></tr></table>"
155
+ "<table><tr><th></th><th>artid</th><th>artname</th><th>timestamp</th><th>traid</th><th>traname</th><th>userid</th></tr><tr><td>0</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03 12:55:00 +0530</td><td>0138547f-374d-49d4-8f1c-9b2c8b5c65c0</td><td>X-Ray Eyes</td><td>user_000705</td></tr><tr><td>1</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03 12:51:28 +0530</td><td>22ce9a32-3510-4c8e-8151-c044a62eb4fd</td><td>Hard Times</td><td>user_000705</td></tr><tr><td>2</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03 12:46:55 +0530</td><td>22ce9a32-3510-4c8e-8151-c044a62eb4fd</td><td>Hard Times</td><td>user_000705</td></tr><tr><td>3</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03 12:42:17 +0530</td><td>c386b85f-1bfe-4038-b323-cb8229ab2f8b</td><td>Magic Touch</td><td>user_000705</td></tr><tr><td>4</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03 12:37:53 +0530</td><td>8ec9b4f8-2d1b-4616-9ae4-4711ca328fc3</td><td>Charisma</td><td>user_000705</td></tr><tr><td>5</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03 12:33:37 +0530</td><td>ff47d82e-313d-4bd0-8e61-fe61124a361b</td><td>Dirty Livin'</td><td>user_000705</td></tr><tr><td>6</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03 12:29:39 +0530</td><td>3621800b-87b7-43c6-b6a3-47ea4b658407</td><td>Sure Know Something</td><td>user_000705</td></tr><tr><td>7</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03 12:24:46 +0530</td><td>91cc5010-e65b-4f49-94b5-1deed61cfcc7</td><td>2,000 Man</td><td>user_000705</td></tr><tr><td>8</td><td>e1f1e33e-2e4c-4d43-b91b-7064068d3283</td><td>Kiss</td><td>2009-05-03 12:20:17 +0530</td><td>daa13e72-9056-476f-b431-335b2c26842d</td><td>I Was Made For Lovin' You</td><td>user_000705</td></tr><tr><td>9</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03 12:16:20 +0530</td><td>1895c79d-ae5f-40bf-bc18-83fdcd8d2842</td><td>Burning Of The Midnight Lamp</td><td>user_000705</td></tr><tr><td>10</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03 12:12:35 +0530</td><td>1ae3c250-7b16-49d4-9c71-0928724eecce</td><td>Gypsy Eyes</td><td>user_000705</td></tr><tr><td>11</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03 12:08:26 +0530</td><td>fca63fe0-c9e6-4347-92b7-21f6cf79226c</td><td>Come On, Part 1</td><td>user_000705</td></tr><tr><td>12</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03 12:04:59 +0530</td><td>36beb31d-ed74-4a49-832f-a4a38dc96bab</td><td>Long Hot Summer Night</td><td>user_000705</td></tr><tr><td>13</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03 12:02:08 +0530</td><td>4ad6064e-7d54-49a2-a134-320a1612ee27</td><td>Little Miss Strange</td><td>user_000705</td></tr><tr><td>14</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03 11:47:07 +0530</td><td>40ffef8e-b851-473a-a239-08685eab22b0</td><td>Voodoo Chile</td><td>user_000705</td></tr><tr><td>15</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03 11:44:43 +0530</td><td>feb64d01-6e05-4974-bb44-0046deca1bdb</td><td>Crosstown Traffic</td><td>user_000705</td></tr><tr><td>16</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03 11:42:35 +0530</td><td>7f9b462a-8ac5-472d-a5aa-716b3b3d169c</td><td>Have You Ever Been (To Electric Ladyland)</td><td>user_000705</td></tr><tr><td>17</td><td>33b3c323-77c2-417c-a5b4-af7e6a111cc9</td><td>The Jimi Hendrix Experience</td><td>2009-05-03 11:41:13 +0530</td><td>88b57468-8d58-4310-b135-c94620fcfbc1</td><td>...And The Gods Made Love</td><td>user_000705</td></tr><tr><td>18</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02 09:24:28 +0530</td><td>788878e0-8965-489e-86e3-add4c1f3d134</td><td>Line Of Best Fit</td><td>user_000705</td></tr><tr><td>19</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02 09:19:58 +0530</td><td>7cfc403d-18e7-4b8e-b0c4-1864ca393fbb</td><td>Fake Frowns</td><td>user_000705</td></tr><tr><td>20</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02 09:15:03 +0530</td><td>34a2d7ad-6b3a-4cfc-b4ca-edfc55a6685b</td><td>Amputations</td><td>user_000705</td></tr><tr><td>21</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02 09:11:21 +0530</td><td>99db2ed6-4493-481c-ac20-54ad323cb04b</td><td>The Face That Launched 1000 Shits</td><td>user_000705</td></tr><tr><td>22</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02 09:07:44 +0530</td><td>269084ba-3065-4b43-a733-f491e618b26a</td><td>Sleep Spent</td><td>user_000705</td></tr><tr><td>23</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02 09:03:54 +0530</td><td>96fac269-5308-4aee-827f-d01a66674694</td><td>Pictures In An Exhibition</td><td>user_000705</td></tr><tr><td>24</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02 08:59:34 +0530</td><td>c29440d9-03e6-4e18-91d6-ef8bf1e1ca32</td><td>Your Bruise</td><td>user_000705</td></tr><tr><td>25</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02 08:56:55 +0530</td><td>ed55b695-976e-4898-8fde-51a8e3b0e262</td><td>Champagne From A Paper Cup</td><td>user_000705</td></tr><tr><td>26</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02 08:49:07 +0530</td><td>c5238d6d-9b04-496c-8674-4ea7a07aecd6</td><td>President Of What?</td><td>user_000705</td></tr><tr><td>27</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-02 08:44:34 +0530</td><td>bf59dfef-03a8-4270-9456-50df79da56c2</td><td>Bend To Squares</td><td>user_000705</td></tr><tr><td>28</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-01 19:08:37 +0530</td><td>788878e0-8965-489e-86e3-add4c1f3d134</td><td>Line Of Best Fit</td><td>user_000705</td></tr><tr><td>29</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-01 19:04:07 +0530</td><td>7cfc403d-18e7-4b8e-b0c4-1864ca393fbb</td><td>Fake Frowns</td><td>user_000705</td></tr><tr><td>30</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-01 18:59:12 +0530</td><td>34a2d7ad-6b3a-4cfc-b4ca-edfc55a6685b</td><td>Amputations</td><td>user_000705</td></tr><tr><td>31</td><td>0039c7ae-e1a7-4a7d-9b49-0cbc716821a6</td><td>Death Cab For Cutie</td><td>2009-05-01 18:55:30 +0530</td><td>99db2ed6-4493-481c-ac20-54ad323cb04b</td><td>The Face That Launched 1000 Shits</td><td>user_000705</td></tr><tr><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td></tr></table>"
156
156
  ],
157
157
  "metadata": {},
158
158
  "output_type": "pyout",
159
159
  "prompt_number": 3,
160
160
  "text": [
161
161
  "\n",
162
- "#<Daru::DataFrame:90310500 @name = 59f7207f-059f-4bb8-8315-2c7625c19dd2 @size = 2500>\n",
163
- " userid timestamp artid artname traid traname \n",
164
- " 0 user_00070 2009-05-03 e1f1e33e-2 Kiss 0138547f-3 X-Ray Eyes \n",
165
- " 1 user_00070 2009-05-03 e1f1e33e-2 Kiss 22ce9a32-3 Hard Times \n",
166
- " 2 user_00070 2009-05-03 e1f1e33e-2 Kiss 22ce9a32-3 Hard Times \n",
167
- " 3 user_00070 2009-05-03 e1f1e33e-2 Kiss c386b85f-1 Magic Touc \n",
168
- " 4 user_00070 2009-05-03 e1f1e33e-2 Kiss 8ec9b4f8-2 Charisma \n",
169
- " 5 user_00070 2009-05-03 e1f1e33e-2 Kiss ff47d82e-3 Dirty Livi \n",
170
- " 6 user_00070 2009-05-03 e1f1e33e-2 Kiss 3621800b-8 Sure Know \n",
171
- " 7 user_00070 2009-05-03 e1f1e33e-2 Kiss 91cc5010-e 2,000 Man \n",
172
- " 8 user_00070 2009-05-03 e1f1e33e-2 Kiss daa13e72-9 I Was Made \n",
173
- " 9 user_00070 2009-05-03 33b3c323-7 The Jimi H 1895c79d-a Burning Of \n",
174
- " 10 user_00070 2009-05-03 33b3c323-7 The Jimi H 1ae3c250-7 Gypsy Eyes \n",
175
- " 11 user_00070 2009-05-03 33b3c323-7 The Jimi H fca63fe0-c Come On, P \n",
176
- " 12 user_00070 2009-05-03 33b3c323-7 The Jimi H 36beb31d-e Long Hot S \n",
177
- " 13 user_00070 2009-05-03 33b3c323-7 The Jimi H 4ad6064e-7 Little Mis \n",
178
- " 14 user_00070 2009-05-03 33b3c323-7 The Jimi H 40ffef8e-b Voodoo Chi \n",
162
+ "#<Daru::DataFrame:88577360 @name = ae5b6be9-f08c-4e79-a0f3-ead8016fd7ee @size = 2500>\n",
163
+ " artid artname timestamp traid traname userid \n",
164
+ " 0 e1f1e33e-2 Kiss 2009-05-03 0138547f-3 X-Ray Eyes user_00070 \n",
165
+ " 1 e1f1e33e-2 Kiss 2009-05-03 22ce9a32-3 Hard Times user_00070 \n",
166
+ " 2 e1f1e33e-2 Kiss 2009-05-03 22ce9a32-3 Hard Times user_00070 \n",
167
+ " 3 e1f1e33e-2 Kiss 2009-05-03 c386b85f-1 Magic Touc user_00070 \n",
168
+ " 4 e1f1e33e-2 Kiss 2009-05-03 8ec9b4f8-2 Charisma user_00070 \n",
169
+ " 5 e1f1e33e-2 Kiss 2009-05-03 ff47d82e-3 Dirty Livi user_00070 \n",
170
+ " 6 e1f1e33e-2 Kiss 2009-05-03 3621800b-8 Sure Know user_00070 \n",
171
+ " 7 e1f1e33e-2 Kiss 2009-05-03 91cc5010-e 2,000 Man user_00070 \n",
172
+ " 8 e1f1e33e-2 Kiss 2009-05-03 daa13e72-9 I Was Made user_00070 \n",
173
+ " 9 33b3c323-7 The Jimi H 2009-05-03 1895c79d-a Burning Of user_00070 \n",
174
+ " 10 33b3c323-7 The Jimi H 2009-05-03 1ae3c250-7 Gypsy Eyes user_00070 \n",
175
+ " 11 33b3c323-7 The Jimi H 2009-05-03 fca63fe0-c Come On, P user_00070 \n",
176
+ " 12 33b3c323-7 The Jimi H 2009-05-03 36beb31d-e Long Hot S user_00070 \n",
177
+ " 13 33b3c323-7 The Jimi H 2009-05-03 4ad6064e-7 Little Mis user_00070 \n",
178
+ " 14 33b3c323-7 The Jimi H 2009-05-03 40ffef8e-b Voodoo Chi user_00070 \n",
179
179
  " ... ... ... ... ... ... ... \n"
180
180
  ]
181
181
  }
@@ -186,111 +186,96 @@
186
186
  "cell_type": "code",
187
187
  "collapsed": false,
188
188
  "input": [
189
- "artist_counts = {}\n",
190
- "\n",
191
- "# Populate a hash which has artist names as keys with corresponding values set to the number of times the name of the artist\n",
192
- "# has appeared.\n",
193
- "artists = df.artname.uniq\n",
194
- "artists.each do |artist|\n",
195
- " artist_counts[artist] = df.artname.count(artist)\n",
196
- "end\n",
197
- "\n",
198
- "# Since indexes are stored as symbols, convert each artist name to camel_case\n",
199
- "a= artist_counts.to_a.each do |name_val_pair|\n",
200
- " name_val_pair[0] = name_val_pair[0].downcase.split(' ').join('_')\n",
201
- "end\n",
202
- "counts = Daru::Vector.new Hash[a], name: :counts"
189
+ "# Group by artist name and call 'size' to see the number of rows each artist populates.\n",
190
+ "artists = df.group_by(:artname).size"
203
191
  ],
204
192
  "language": "python",
205
193
  "metadata": {},
206
194
  "outputs": [
207
195
  {
208
196
  "html": [
209
- "<table><tr><th> </th><th>counts</th></tr><tr><td>kiss</td><td>19</td></tr><tr><td>the_jimi_hendrix_experience</td><td>39</td></tr><tr><td>death_cab_for_cutie</td><td>206</td></tr><tr><td>the_rolling_stones</td><td>91</td></tr><tr><td>the_who</td><td>45</td></tr><tr><td>pink_floyd</td><td>158</td></tr><tr><td>o.s.t.r.</td><td>1</td></tr><tr><td>nickel_creek</td><td>1</td></tr><tr><td>black_sabbath</td><td>3</td></tr><tr><td>w.a.s.p.</td><td>1</td></tr><tr><td>wishbone_ash</td><td>1</td></tr><tr><td>leonard_cohen</td><td>1</td></tr><tr><td>jefferson_airplane</td><td>10</td></tr><tr><td>syd_barrett</td><td>2</td></tr><tr><td>sniff_'n'_the_tears</td><td>1</td></tr><tr><td>jean_sibelius</td><td>1</td></tr><tr><td>the_doors</td><td>7</td></tr><tr><td>renaissance</td><td>1</td></tr><tr><td>marillion</td><td>2</td></tr><tr><td>anathema</td><td>4</td></tr><tr><td>jimi_hendrix</td><td>3</td></tr><tr><td>riverside</td><td>2</td></tr><tr><td>jethro_tull</td><td>1</td></tr><tr><td>the_alan_parsons_project</td><td>1</td></tr><tr><td>eric_clapton</td><td>8</td></tr><tr><td>red_sparowes</td><td>1</td></tr><tr><td>liquid_tension_experiment</td><td>2</td></tr><tr><td>dire_straits</td><td>16</td></tr><tr><td>rio_reiser</td><td>1</td></tr><tr><td>primus</td><td>1</td></tr><tr><td>andrew_lloyd_webber</td><td>1</td></tr><tr><td>focus</td><td>5</td></tr><tr><td>...</td><td>...</td></tr></table>"
197
+ "<table><tr><th> </th><th>size</th></tr><tr><td>3 Doors Down</td><td>3</td></tr><tr><td>A Perfect Circle</td><td>1</td></tr><tr><td>A. R. Rahman</td><td>231</td></tr><tr><td>Abba</td><td>1</td></tr><tr><td>Aditi Singh Sharma</td><td>3</td></tr><tr><td>Aerosmith</td><td>1</td></tr><tr><td>Air</td><td>1</td></tr><tr><td>Akurat</td><td>1</td></tr><tr><td>Alanis Morissette</td><td>5</td></tr><tr><td>Alice Cooper</td><td>2</td></tr><tr><td>Alice In Chains</td><td>1</td></tr><tr><td>Alison Krauss</td><td>1</td></tr><tr><td>Altamiro Carrilho</td><td>1</td></tr><tr><td>Alvin Youngblood Hart</td><td>3</td></tr><tr><td>America</td><td>1</td></tr><tr><td>Amit Trivedi</td><td>20</td></tr><tr><td>Amon Amarth</td><td>1</td></tr><tr><td>Anathema</td><td>4</td></tr><tr><td>Andrea Bocelli</td><td>16</td></tr><tr><td>Andrea Bocelli;Christina Aquilera</td><td>2</td></tr><tr><td>Andrea Bocelli;Kenny G</td><td>2</td></tr><tr><td>Andrea Bocelli;Mario Reyes</td><td>1</td></tr><tr><td>Andrew Lloyd Webber</td><td>1</td></tr><tr><td>Anton Maiden</td><td>2</td></tr><tr><td>Antsy Pants</td><td>2</td></tr><tr><td>Apocalyptica</td><td>9</td></tr><tr><td>Archive</td><td>1</td></tr><tr><td>Arctic Monkeys</td><td>1</td></tr><tr><td>Aretha Franklin</td><td>4</td></tr><tr><td>Asia</td><td>1</td></tr><tr><td>Audioslave</td><td>1</td></tr><tr><td>Aurelio Fierro</td><td>1</td></tr><tr><td>...</td><td>...</td></tr></table>"
210
198
  ],
211
199
  "metadata": {},
212
200
  "output_type": "pyout",
213
- "prompt_number": 4,
201
+ "prompt_number": 7,
214
202
  "text": [
215
203
  "\n",
216
- "#<Daru::Vector:-624202978 @name = counts @size = 376 >\n",
217
- " counts\n",
218
- " kiss 19\n",
219
- "the_jimi_h 39\n",
220
- "death_cab_ 206\n",
221
- "the_rollin 91\n",
222
- " the_who 45\n",
223
- "pink_floyd 158\n",
224
- " o.s.t.r. 1\n",
225
- "nickel_cre 1\n",
226
- "black_sabb 3\n",
227
- " w.a.s.p. 1\n",
228
- "wishbone_a 1\n",
229
- "leonard_co 1\n",
230
- "jefferson_ 10\n",
231
- "syd_barret 2\n",
232
- "sniff_'n'_ 1\n",
233
- "jean_sibel 1\n",
234
- " the_doors 7\n",
235
- " ... ...\n"
204
+ "#<Daru::Vector:88196900 @name = size @size = 376 >\n",
205
+ " size\n",
206
+ " 3 Doors Down 3\n",
207
+ " A Perfect Circle 1\n",
208
+ " A. R. Rahman 231\n",
209
+ " Abba 1\n",
210
+ " Aditi Singh Sharma 3\n",
211
+ " Aerosmith 1\n",
212
+ " Air 1\n",
213
+ " Akurat 1\n",
214
+ " Alanis Morissette 5\n",
215
+ " Alice Cooper 2\n",
216
+ " Alice In Chains 1\n",
217
+ " Alison Krauss 1\n",
218
+ " Altamiro Carrilho 1\n",
219
+ "Alvin Youngblood Har 3\n",
220
+ " America 1\n",
221
+ " Amit Trivedi 20\n",
222
+ " Amon Amarth 1\n",
223
+ " ... ...\n"
236
224
  ]
237
225
  }
238
226
  ],
239
- "prompt_number": 4
227
+ "prompt_number": 7
240
228
  },
241
229
  {
242
230
  "cell_type": "code",
243
231
  "collapsed": false,
244
232
  "input": [
245
- "counts.max :vector"
233
+ "artists.max_index"
246
234
  ],
247
235
  "language": "python",
248
236
  "metadata": {},
249
237
  "outputs": [
250
238
  {
251
239
  "html": [
252
- "<table><tr><th> </th><th>counts</th></tr><tr><td>a._r._rahman</td><td>231</td></tr></table>"
240
+ "<table><tr><th> </th><th>size</th></tr><tr><td>A. R. Rahman</td><td>231</td></tr></table>"
253
241
  ],
254
242
  "metadata": {},
255
243
  "output_type": "pyout",
256
- "prompt_number": 5,
244
+ "prompt_number": 14,
257
245
  "text": [
258
246
  "\n",
259
- "#<Daru::Vector:106370640 @name = counts @size = 1 >\n",
260
- " counts\n",
261
- "a._r._rahm 231\n"
247
+ "#<Daru::Vector:86142110 @name = size @size = 1 >\n",
248
+ " size\n",
249
+ "A. R. Rahman 231\n"
262
250
  ]
263
251
  }
264
252
  ],
265
- "prompt_number": 5
253
+ "prompt_number": 14
266
254
  },
267
255
  {
268
256
  "cell_type": "code",
269
257
  "collapsed": false,
270
258
  "input": [
271
- "top_ten = counts.sort[-10..-1]\n",
272
- "\n",
273
- "hsh = {}\n",
259
+ "top_ten = artists.sort(ascending: false)[0..10]\n",
274
260
  "\n",
275
- "top_ten.each do |count|\n",
276
- " hsh[counts.index_of(count)] = count\n",
277
- "end\n",
278
- "\n",
279
- "ten = Daru::Vector.new hsh\n",
280
- "\n",
281
- "ten.plot type: :bar, width: 1120, height: 300"
261
+ "top_ten.plot type: :bar do |plt| \n",
262
+ " plt.width 1120 \n",
263
+ " plt.height 500\n",
264
+ " plt.legend true\n",
265
+ " plt.rotate_x_label 20\n",
266
+ "end"
282
267
  ],
283
268
  "language": "python",
284
269
  "metadata": {},
285
270
  "outputs": [
286
271
  {
287
272
  "html": [
288
- "<div id='vis-2d129c89-0b03-4c0a-832b-d699e419e9a4'></div>\n",
273
+ "<div id='vis-5ee90e94-e93a-4506-817f-b036c2a9a7f6'></div>\n",
289
274
  "<script>\n",
290
275
  "(function(){\n",
291
276
  " var render = function(){\n",
292
- " var model = {\"panes\":[{\"diagrams\":[{\"type\":\"bar\",\"options\":{\"x\":\"data0\",\"y\":\"data1\"},\"data\":\"a44501de-509e-411f-b01e-4f5b27d9dcda\"}],\"options\":{\"width\":1120,\"height\":300,\"x_label\":\"\",\"y_label\":\"\",\"xrange\":[\"nick_drake\",\"howard_shore\",\"cat_stevens\",\"the_cranberries\",\"the_beatles\",\"opeth\",\"the_rolling_stones\",\"pink_floyd\",\"death_cab_for_cutie\",\"a._r._rahman\"],\"yrange\":[0,231]}}],\"data\":{\"a44501de-509e-411f-b01e-4f5b27d9dcda\":[{\"data0\":\"nick_drake\",\"data1\":51},{\"data0\":\"howard_shore\",\"data1\":56},{\"data0\":\"cat_stevens\",\"data1\":57},{\"data0\":\"the_cranberries\",\"data1\":61},{\"data0\":\"the_beatles\",\"data1\":67},{\"data0\":\"opeth\",\"data1\":89},{\"data0\":\"the_rolling_stones\",\"data1\":91},{\"data0\":\"pink_floyd\",\"data1\":158},{\"data0\":\"death_cab_for_cutie\",\"data1\":206},{\"data0\":\"a._r._rahman\",\"data1\":231}]},\"extension\":[]}\n",
293
- " Nyaplot.core.parse(model, '#vis-2d129c89-0b03-4c0a-832b-d699e419e9a4');\n",
277
+ " var model = {\"panes\":[{\"diagrams\":[{\"type\":\"bar\",\"options\":{\"x\":\"data0\",\"y\":\"data1\"},\"data\":\"252f4b57-0e4e-4358-ab33-8ca341895f4e\"}],\"options\":{\"width\":1120,\"height\":500,\"legend\":true,\"rotate_x_label\":20,\"xrange\":[\"A. R. Rahman\",\"Death Cab For Cutie\",\"Pink Floyd\",\"The Rolling Stones\",\"Opeth\",\"The Beatles\",\"The Cranberries\",\"Cat Stevens\",\"Howard Shore\",\"Nick Drake\",\"Metallica\"],\"yrange\":[0,231]}}],\"data\":{\"252f4b57-0e4e-4358-ab33-8ca341895f4e\":[{\"data0\":\"A. R. Rahman\",\"data1\":231},{\"data0\":\"Death Cab For Cutie\",\"data1\":206},{\"data0\":\"Pink Floyd\",\"data1\":158},{\"data0\":\"The Rolling Stones\",\"data1\":91},{\"data0\":\"Opeth\",\"data1\":89},{\"data0\":\"The Beatles\",\"data1\":67},{\"data0\":\"The Cranberries\",\"data1\":61},{\"data0\":\"Cat Stevens\",\"data1\":57},{\"data0\":\"Howard Shore\",\"data1\":56},{\"data0\":\"Nick Drake\",\"data1\":51},{\"data0\":\"Metallica\",\"data1\":48}]},\"extension\":[]}\n",
278
+ " Nyaplot.core.parse(model, '#vis-5ee90e94-e93a-4506-817f-b036c2a9a7f6');\n",
294
279
  " };\n",
295
280
  " if(window['Nyaplot']==undefined){\n",
296
281
  " window.addEventListener('load_nyaplot', render, false);\n",
@@ -303,13 +288,13 @@
303
288
  ],
304
289
  "metadata": {},
305
290
  "output_type": "pyout",
306
- "prompt_number": 6,
291
+ "prompt_number": 17,
307
292
  "text": [
308
- "#<Nyaplot::Frame:0xb597e0f4 @properties={:panes=>[#<Nyaplot::Plot:0xb597f828 @properties={:diagrams=>[#<Nyaplot::Diagram:0xb597e360 @properties={:type=>:bar, :options=>{:x=>\"data0\", :y=>\"data1\"}, :data=>\"a44501de-509e-411f-b01e-4f5b27d9dcda\"}, @xrange=[:nick_drake, :howard_shore, :cat_stevens, :the_cranberries, :the_beatles, :opeth, :the_rolling_stones, :pink_floyd, :death_cab_for_cutie, :\"a._r._rahman\"], @yrange=[0, 231]>], :options=>{:width=>1120, :height=>300, :x_label=>\"\", :y_label=>\"\", :xrange=>[:nick_drake, :howard_shore, :cat_stevens, :the_cranberries, :the_beatles, :opeth, :the_rolling_stones, :pink_floyd, :death_cab_for_cutie, :\"a._r._rahman\"], :yrange=>[0, 231]}}>], :data=>{\"a44501de-509e-411f-b01e-4f5b27d9dcda\"=>#<Nyaplot::DataFrame:0xb597f134 @name=\"a44501de-509e-411f-b01e-4f5b27d9dcda\", @rows=[{:data0=>:nick_drake, :data1=>51}, {:data0=>:howard_shore, :data1=>56}, {:data0=>:cat_stevens, :data1=>57}, {:data0=>:the_cranberries, :data1=>61}, {:data0=>:the_beatles, :data1=>67}, {:data0=>:opeth, :data1=>89}, {:data0=>:the_rolling_stones, :data1=>91}, {:data0=>:pink_floyd, :data1=>158}, {:data0=>:death_cab_for_cutie, :data1=>206}, {:data0=>:\"a._r._rahman\", :data1=>231}]>}, :extension=>[]}>"
293
+ "#<Nyaplot::Frame:0xa1c1614 @properties={:panes=>[#<Nyaplot::Plot:0xa1c2488 @properties={:diagrams=>[#<Nyaplot::Diagram:0xa1c190c @properties={:type=>:bar, :options=>{:x=>\"data0\", :y=>\"data1\"}, :data=>\"252f4b57-0e4e-4358-ab33-8ca341895f4e\"}, @xrange=[:\"A. R. Rahman\", :\"Death Cab For Cutie\", :\"Pink Floyd\", :\"The Rolling Stones\", :Opeth, :\"The Beatles\", :\"The Cranberries\", :\"Cat Stevens\", :\"Howard Shore\", :\"Nick Drake\", :Metallica], @yrange=[0, 231]>], :options=>{:width=>1120, :height=>500, :legend=>true, :rotate_x_label=>20, :xrange=>[:\"A. R. Rahman\", :\"Death Cab For Cutie\", :\"Pink Floyd\", :\"The Rolling Stones\", :Opeth, :\"The Beatles\", :\"The Cranberries\", :\"Cat Stevens\", :\"Howard Shore\", :\"Nick Drake\", :Metallica], :yrange=>[0, 231]}}>], :data=>{\"252f4b57-0e4e-4358-ab33-8ca341895f4e\"=>#<Nyaplot::DataFrame:0xa1c2154 @name=\"252f4b57-0e4e-4358-ab33-8ca341895f4e\", @rows=[{:data0=>:\"A. R. Rahman\", :data1=>231}, {:data0=>:\"Death Cab For Cutie\", :data1=>206}, {:data0=>:\"Pink Floyd\", :data1=>158}, {:data0=>:\"The Rolling Stones\", :data1=>91}, {:data0=>:Opeth, :data1=>89}, {:data0=>:\"The Beatles\", :data1=>67}, {:data0=>:\"The Cranberries\", :data1=>61}, {:data0=>:\"Cat Stevens\", :data1=>57}, {:data0=>:\"Howard Shore\", :data1=>56}, {:data0=>:\"Nick Drake\", :data1=>51}, {:data0=>:Metallica, :data1=>48}]>}, :extension=>[]}>"
309
294
  ]
310
295
  }
311
296
  ],
312
- "prompt_number": 6
297
+ "prompt_number": 17
313
298
  }
314
299
  ],
315
300
  "metadata": {}
@@ -0,0 +1,36 @@
1
+ require 'spec_helper.rb'
2
+
3
+ describe Daru::Accessors::NMatrixWrapper do
4
+ before :each do
5
+ stub_context = Object.new
6
+ @nm_wrapper = Daru::Accessors::NMatrixWrapper.new([1,2,3,4,5], stub_context, :float32)
7
+ end
8
+
9
+ it "checks for actual NMatrix creation" do
10
+ expect(@nm_wrapper.data.class).to eq(NMatrix)
11
+ end
12
+
13
+ it "checks the actual size of the NMatrix object" do
14
+ expect(@nm_wrapper.data.size).to eq(10)
15
+ end
16
+
17
+ it "checks that @size is the number of elements in the vector" do
18
+ expect(@nm_wrapper.size).to eq(5)
19
+ end
20
+
21
+ it "checks for underlying NMatrix data type" do
22
+ expect(@nm_wrapper.data.dtype).to eq(:float32)
23
+ end
24
+
25
+ it "resizes" do
26
+ @nm_wrapper.resize(100)
27
+
28
+ expect(@nm_wrapper.size).to eq(5)
29
+ expect(@nm_wrapper.data.size).to eq(100)
30
+ expect(@nm_wrapper.data).to eq(NMatrix.new [100], [1,2,3,4,5])
31
+ end
32
+ end
33
+
34
+ describe Daru::Accessors::ArrayWrapper do
35
+
36
+ end
@@ -0,0 +1,331 @@
1
+ require 'spec_helper.rb'
2
+
3
+ describe Daru::Core::GroupBy do
4
+ before do
5
+ @df = Daru::DataFrame.new({
6
+ a: %w{foo bar foo bar foo bar foo foo},
7
+ b: %w{one one two three two two one three},
8
+ c: [1 ,2 ,3 ,1 ,3 ,6 ,3 ,8],
9
+ d: [11 ,22 ,33 ,44 ,55 ,66 ,77 ,88]
10
+ })
11
+
12
+ @sl_group = @df.group_by(:a)
13
+ @dl_group = @df.group_by([:a, :b])
14
+ @tl_group = @df.group_by([:a,:b,:c])
15
+
16
+ @sl_index = Daru::Index.new([:bar, :foo])
17
+ @dl_multi_index = Daru::MultiIndex.new([
18
+ [:bar, :one],
19
+ [:bar, :three],
20
+ [:bar, :two],
21
+ [:foo, :one],
22
+ [:foo, :three],
23
+ [:foo, :two]
24
+ ])
25
+ @tl_multi_index = Daru::MultiIndex.new([
26
+ [:bar, :one , 2],
27
+ [:bar, :three, 1],
28
+ [:bar, :two , 6],
29
+ [:foo, :one , 1],
30
+ [:foo, :one , 3],
31
+ [:foo, :three, 8],
32
+ [:foo, :two , 3]
33
+ ])
34
+ end
35
+
36
+ context "#initialize" do
37
+ it "groups by a single tuple" do
38
+ expect(@sl_group.groups).to eq({
39
+ ['bar'] => [1,3,5],
40
+ ['foo'] => [0,2,4,6,7]
41
+ })
42
+ end
43
+
44
+ it "groups by a double layer hierarchy" do
45
+ expect(@dl_group.groups).to eq({
46
+ ['foo', 'one'] => [0,6],
47
+ ['bar', 'one'] => [1],
48
+ ['foo', 'two'] => [2,4],
49
+ ['bar', 'three'] => [3],
50
+ ['bar', 'two'] => [5],
51
+ ['foo', 'three'] => [7]
52
+ })
53
+ end
54
+
55
+ it "groups by a triple layer hierarchy" do
56
+ expect(@tl_group.groups).to eq({
57
+ ['bar', 'one' , 2] => [1],
58
+ ['bar', 'three', 1] => [3],
59
+ ['bar', 'two' , 6] => [5],
60
+ ['foo', 'one' , 1] => [0],
61
+ ['foo', 'one' , 3] => [6],
62
+ ['foo', 'three', 8] => [7],
63
+ ['foo', 'two' , 3] => [2,4]
64
+ })
65
+ end
66
+
67
+ it "raises error if a non-existent vector is passed as args" do
68
+ expect {
69
+ @df.group_by([:a, :ted])
70
+ }.to raise_error
71
+ end
72
+ end
73
+
74
+ context "#size" do
75
+ it "returns a vector containing the size of each group" do
76
+ expect(@dl_group.size).to eq(Daru::Vector.new([1,1,1,2,1,2], index: @dl_multi_index))
77
+ end
78
+ end
79
+
80
+ context "#get_group" do
81
+ it "returns the whole sub-group for single layer grouping" do
82
+ expect(@sl_group.get_group(['bar'])).to eq(Daru::DataFrame.new({
83
+ a: ['bar', 'bar', 'bar'],
84
+ b: ['one', 'three', 'two'],
85
+ c: [2,1,6],
86
+ d: [22,44,66]
87
+ }, index: [1,3,5]
88
+ ))
89
+ end
90
+
91
+ it "returns the whole sub-group for double layer grouping" do
92
+ expect(@dl_group.get_group(['bar', 'one'])).to eq(Daru::DataFrame.new({
93
+ a: ['bar'],
94
+ b: ['one'],
95
+ c: [2],
96
+ d: [22]
97
+ }, index: [1]
98
+ ))
99
+
100
+ puts @dl_group.get_group(["foo", "one"]).inspect
101
+ end
102
+
103
+ it "returns the whole sub-group for triple layer grouping" do
104
+ expect(@tl_group.get_group(['foo','two',3])).to eq(Daru::DataFrame.new({
105
+ a: ['foo', 'foo'],
106
+ b: ['two', 'two'],
107
+ c: [3,3],
108
+ d: [33,55]
109
+ }, index: [2,4]
110
+ ))
111
+ end
112
+
113
+ it "raises error for incomplete specification" do
114
+ expect {
115
+ @tl_group.get_group(['foo'])
116
+ }.to raise_error
117
+ end
118
+
119
+ it "raises error for over specification" do
120
+ expect {
121
+ @sl_group.get_group(['bar', 'one'])
122
+ }.to raise_error
123
+ end
124
+ end
125
+
126
+ context "#aggregate" do
127
+ pending
128
+ end
129
+
130
+ context "#mean" do
131
+ it "computes mean of the numeric columns of a single layer group" do
132
+ expect(@sl_group.mean).to eq(Daru::DataFrame.new({
133
+ :c => [3.0, 3.6],
134
+ :d => [44.0, 52.8]
135
+ }, index: @sl_index
136
+ ))
137
+ end
138
+
139
+ it "computes mean of the numeric columns of a double layer group" do
140
+ expect(@dl_group.mean).to eq(Daru::DataFrame.new({
141
+ c: [2,1,6,2,8,3],
142
+ d: [22,44,66,44,88,44]
143
+ }, index: @dl_multi_index))
144
+ end
145
+
146
+ it "computes mean of the numeric columns of a triple layer group" do
147
+ expect(@tl_group.mean).to eq(Daru::DataFrame.new({
148
+ d: [22,44,66,11,77,88,44]
149
+ }, index: @tl_multi_index
150
+ ))
151
+ end
152
+ end
153
+
154
+ context "#sum" do
155
+ it "calculates the sum of the numeric columns of a single layer group" do
156
+ expect(@sl_group.sum).to eq(Daru::DataFrame.new({
157
+ c: [9, 18],
158
+ d: [132, 264]
159
+ }, index: @sl_index
160
+ ))
161
+ end
162
+
163
+ it "calculates the sum of the numeric columns of a double layer group" do
164
+ expect(@dl_group.sum).to eq(Daru::DataFrame.new({
165
+ c: [2,1,6,4,8,6],
166
+ d: [22,44,66,88,88,88]
167
+ }, index: @dl_multi_index))
168
+ end
169
+
170
+ it "calculates the sum of the numeric columns of a triple layer group" do
171
+ expect(@tl_group.sum).to eq(Daru::DataFrame.new({
172
+ d: [22,44,66,11,77,88,88]
173
+ }, index: @tl_multi_index))
174
+ end
175
+ end
176
+
177
+ context "#product" do
178
+ it "calculates product for single layer groups" do
179
+ # TODO
180
+ end
181
+
182
+ it "calculates product for double layer groups" do
183
+ # TODO
184
+ end
185
+
186
+ it "calculates product for triple layer groups" do
187
+ # TODO
188
+ end
189
+ end
190
+
191
+ context "#count" do
192
+ it "counts the number of elements in a single layer group" do
193
+ expect(@sl_group.count).to eq(Daru::DataFrame.new({
194
+ b: [3,5],
195
+ c: [3,5],
196
+ d: [3,5]
197
+ }, index: @sl_index))
198
+ end
199
+
200
+ it "counts the number of elements in a double layer group" do
201
+ expect(@dl_group.count).to eq(Daru::DataFrame.new({
202
+ c: [1,1,1,2,1,2],
203
+ d: [1,1,1,2,1,2]
204
+ }, index: @dl_multi_index))
205
+ end
206
+
207
+ it "counts the number of elements in a triple layer group" do
208
+ expect(@tl_group.count).to eq(Daru::DataFrame.new({
209
+ d: [1,1,1,1,1,1,2]
210
+ }, index: @tl_multi_index))
211
+ end
212
+ end
213
+
214
+ context "#std" do
215
+ it "calculates sample standard deviation for single layer groups" do
216
+ # TODO
217
+ end
218
+
219
+ it "calculates sample standard deviation for double layer groups" do
220
+ # TODO
221
+ end
222
+
223
+ it "calculates sample standard deviation for triple layer groups" do
224
+ # TODO
225
+ end
226
+ end
227
+
228
+ context "#max" do
229
+ it "calculates max value for single layer groups" do
230
+ # TODO
231
+ end
232
+
233
+ it "calculates max value for double layer groups" do
234
+ # TODO
235
+ end
236
+
237
+ it "calculates max value for triple layer groups" do
238
+ # TODO
239
+ end
240
+ end
241
+
242
+ context "#min" do
243
+ it "calculates min value for single layer groups" do
244
+ # TODO
245
+ end
246
+
247
+ it "calculates min value for double layer groups" do
248
+ # TODO
249
+ end
250
+
251
+ it "calculates min value for triple layer groups" do
252
+ # TODO
253
+ end
254
+ end
255
+
256
+ context "#median" do
257
+ it "calculates median for single layer groups" do
258
+ # TODO
259
+ end
260
+
261
+ it "calculates median for double layer groups" do
262
+ # TODO
263
+ end
264
+
265
+ it "calculates median for triple layer groups" do
266
+ # TODO
267
+ end
268
+ end
269
+
270
+ context "#head" do
271
+ it "returns first n rows of each single layer group" do
272
+ expect(@sl_group.head(2)).to eq(Daru::DataFrame.new({
273
+ a: ['bar', 'bar','foo','foo'],
274
+ b: ['one', 'three','one', 'two'],
275
+ c: [2, 1, 1, 3],
276
+ d: [22, 44, 11, 33]
277
+ }, index: [1,3,0,2]))
278
+ end
279
+
280
+ it "returns first n rows of each double layer group" do
281
+ expect(@dl_group.head(2)).to eq(Daru::DataFrame.new({
282
+ a: ['bar','bar','bar','foo','foo','foo','foo','foo'],
283
+ b: ['one','three','two','one','one','three','two','two'],
284
+ c: [2,1,6,1,3,8,3,3],
285
+ d: [22,44,66,11,77,88,33,55]
286
+ }, index: [1,3,5,0,6,7,2,4]))
287
+ end
288
+
289
+ it "returns first n rows of each triple layer group" do
290
+ expect(@tl_group.head(1)).to eq(Daru::DataFrame.new({
291
+ a: ['bar','bar','bar','foo','foo','foo','foo'],
292
+ b: ['one','three','two','one','one','three','two'],
293
+ c: [2,1,6,1,3,8,3],
294
+ d: [22,44,66,11,77,88,33]
295
+ }, index: [1,3,5,0,6,7,2]))
296
+ end
297
+ end
298
+
299
+ context "#tail" do
300
+ it "returns last n rows of each single layer group" do
301
+ expect(@sl_group.tail(1)).to eq(Daru::DataFrame.new({
302
+ a: ['bar','foo'],
303
+ b: ['two', 'three'],
304
+ c: [6,8],
305
+ d: [66,88]
306
+ }, index: [5,7]))
307
+ end
308
+
309
+ it "returns last n rows of each double layer group" do
310
+ expect(@dl_group.tail(2)).to eq(Daru::DataFrame.new({
311
+ a: ['bar','bar','bar','foo','foo','foo','foo','foo'],
312
+ b: ['one','three','two','one','one','three','two','two'],
313
+ c: [2,1,6,1,3,8,3,3],
314
+ d: [22,44,66,11,77,88,33,55]
315
+ }, index: [1,3,5,0,6,7,2,4]))
316
+ end
317
+
318
+ it "returns last n rows of each triple layer group" do
319
+ expect(@tl_group.tail(1)).to eq(Daru::DataFrame.new({
320
+ a: ['bar','bar','bar','foo','foo','foo','foo'],
321
+ b: ['one','three','two','one','one','three','two'],
322
+ c: [2,1,6,1,3,8,3],
323
+ d: [22,44,66,11,77,88,55]
324
+ }, index: [1,3,5,0,6,7,4]))
325
+ end
326
+ end
327
+
328
+ context "#[]" do
329
+ pending
330
+ end
331
+ end