Guest User

Untitled

a guest
Jun 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. >>> df = pd.DataFrame({
  2. ... 'stock': ['AAAA', 'BBBB', 'CCCC', 'DDDD', 'EEEE', 'FFFF'],
  3. ... 'disposition': ['buy', 'buy', 'sell', 'hold', 'buy', 'sell']})
  4. >>> df.disposition.map({'buy': -1, 'sell': +1, 'hold': 0})
  5. 0 -1
  6. 1 -1
  7. 2 1
  8. 3 0
  9. 4 -1
  10. 5 1
Add Comment
Please, Sign In to add comment