This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| top_five = SortedSet.new | |
| items.each do |key, value| | |
| latest_time = DateTime.parse(key) | |
| top_five << latest_time | |
| if top_five.to_a.length > 5 | |
| top_five.to_a.shift | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| money = pd.read_csv('MoneyNearVotes113th.csv') | |
| money_no_nvs = money[(money.vote != 'NV')] | |
| def convert_col(x): | |
| if x['vote'] == 'AYE': | |
| x['vote'] = 1 | |
| if x['vote'] == 'NOE': | |
| x['vote'] = 0 | |
| return x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> import annoy | |
| Traceback (most recent call last): | |
| File "<stdin>", line 1, in <module> | |
| File "/Users/klafka/anaconda/lib/python2.7/site-packages/annoy/__init__.py", line 15, in <module> | |
| from .annoylib import * | |
| ImportError: dlopen(/Users/klafka/anaconda/lib/python2.7/site-packages/annoy/annoylib.so, 2): Symbol not found: __ZN5boost6python7objects15function_objectERKNS1_11py_functionERKSt4pairIPKNS0_6detail7keywordES9_E | |
| Referenced from: /Users/klafka/anaconda/lib/python2.7/site-packages/annoy/annoylib.so | |
| Expected in: dynamic lookup | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def test_speed_build_recommender(self): | |
| NUM_CUSTOMERS = 100 | |
| NUM_ITEMS = 100 | |
| NUM_ITEMS_PER_CUST = 10 | |
| fi = {} | |
| for i in xrange(0,NUM_CUSTOMERS): | |
| i = str(i) | |
| fi[i] = randint(0,NUM_ITEMS,50) | |
| fi[i] = [str(x) for x in fi[i]] | |
| t3 = time.time() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [[ 2. 1. 1. 1. 0. 0. 0. 0. 1. 1. 0. 0. 0. 0.] | |
| [ 1. 2. 1. 1. 1. 1. 1. 1. 0. 0. 0. 0. 0. 0.] | |
| [ 1. 1. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] | |
| [ 1. 1. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] | |
| [ 0. 1. 0. 0. 1. 1. 1. 1. 0. 0. 0. 0. 0. 0.] | |
| [ 0. 1. 0. 0. 1. 1. 1. 1. 0. 0. 0. 0. 0. 0.] | |
| [ 0. 1. 0. 0. 1. 1. 2. 2. 0. 0. 1. 1. 1. 1.] | |
| [ 0. 1. 0. 0. 1. 1. 2. 2. 0. 0. 1. 1. 1. 1.] | |
| [ 1. 0. 0. 0. 0. 0. 0. 0. 1. 1. 0. 0. 0. 0.] | |
| [ 1. 0. 0. 0. 0. 0. 0. 0. 1. 1. 0. 0. 0. 0.] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| data: [ | |
| { | |
| id: "4f0f49163dc64862c0000044", | |
| name: "Pop Culture Noob", | |
| type: "collection", | |
| image_url: "http://s3.amazonaws.com/badgeville-production-groups/images/4f0f49163dc64862c0000044/original.png?1331059601", | |
| tip: "Find a Pop Culture post that you really liked? Buzz it! If you loved it, share it with your friends via our social share buttons. Don't forget to show us which pop stars show up on your radar with any post that you tag "popculture." ", | |
| message: "You're now a Pop Culture Noob! Come back and check for the latest gossip to become one of our Pop-arazzi. ", | |
| privileges: "", |