SHARE
TWEET

Untitled

a guest Jul 19th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ~python
  2.  
  3. import pandas as pd
  4.  
  5. brech = pd.DataFrame({'base': [0, 1, 2, 3, 4],
  6.                'min': [0, 3, 4, 8, 32],
  7.                'max': [2, 3, 7, 31, 92]})
  8. datos = pd.DataFrame({'dias': [-10, -12, -13, 8, 5, 15, 20, 0, 3, 10, 40, 31]})
  9.      
  10. dias    base
  11. -10     nan
  12. -12     nan
  13. -13     nan
  14. 8       3
  15. 5       2
  16. 15      3
  17. 20      3
  18. 0       0
  19. 3       1
  20. 10      3
  21. 40      4
  22.      
  23. datos['base'] = datos['dias'].apply(lambda x: [brech['base']
  24.                                    if x > brech.iloc[i,1] and x < brech.iloc[i,2] else ""])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top