Created
December 2, 2013 22:56
-
-
Save wrgoldstein/7760601 to your computer and use it in GitHub Desktop.
This file contains 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 numpy as np | |
import pandas as pd | |
a = pd.DataFrame({'user_id': [8993,8994,8994,9009,9009],\ | |
'amount' : [50.00, 72.00, 72.00, 21.99, 21.99]}) | |
a.set_index('user_id').amount.min() | |
real_ids = [8993,8994,8994,9009,9009] | |
fake_ids = [999999,999998] | |
ids = real_ids+fake_ids | |
sam = np.random.choice(ids, 15, True) | |
#sam = filter(lambda x: x in real_ids, sam) #fixes the problem | |
a.set_index('user_id').ix[sam].dropna(0) | |
#whaat? it makes up rows, occasionally with huge values on the order of 1.0e277 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment