Skip to content

Instantly share code, notes, and snippets.

@wrgoldstein
Created December 2, 2013 22:56
Show Gist options
  • Save wrgoldstein/7760601 to your computer and use it in GitHub Desktop.
Save wrgoldstein/7760601 to your computer and use it in GitHub Desktop.
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