analca3

Pandas problem (cut)

Feb 14th, 2020
848
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # coding: utf-8
  3.  
  4. import pandas as pd
  5.  
  6. df = pd.DataFrame({"date": ["18-01-2017","20-01-2017"],
  7.                    "quality": [1,2],
  8.                    "measure": [0.5,0.5]
  9.                   }
  10.                  )
  11. print(df)
  12.  
  13.  
  14. bands = pd.DataFrame({"quality": [1,2],
  15.                       "good": [0.25, 0.75],
  16.                       "bad": [0.75, 1.0]})
  17. print(bands)
  18.  
  19. labels = ["Good", "Satisfactory", "Bad"]
  20.  
  21. ####
  22.  
  23. ####
  24.  
  25. # Expected output
  26. # ["Satisfactory", "Good"]
Add Comment
Please, Sign In to add comment