Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. def dropSmall(df):
  2. list = []
  3. for i in df.columns: #b, c, z ..
  4. if i != 'valeur' and i!='unite':
  5. list.append(i)
  6. # iterating on rows
  7. for j in range(df.groupby(list).sum().shape[0]):
  8. myMax = df.groupby(list).sum().iloc[:, 0].max() / 30
  9. myJ = df.groupby(list).sum().iloc[:, 0][j]
  10. myDf = df.groupby(list).sum().iloc[:, 0]
  11. if myJ <= myMax:
  12. df = df[myDf['value']>= myMax]
  13.  
  14. name b c z l sL value unit
  15. 3099 Myindicator 1 1 3 NA NA 129.74 kg
  16. 3100 1 44929.74 kg
  17. 3101 2 5174.74 kg
  18. 3110 3 1 3 1 NA 2497.66 kg
  19. 3156 2 NA 29.43 kg
  20. 3222 3 NA 304.81 kg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement