Advertisement
Mancolo

Untitled

Dec 3rd, 2020
521
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. import pandas as pd
  2.  
  3. re = pd.read_excel('food.xlsx')
  4. #3
  5. print(re.iloc[21,5])
  6. print(re['Quantity'][21])
  7. #4
  8. print(re.head(4))
  9. # #5
  10. print(re['Quantity'][38:44])
  11. num = 0
  12. # #a
  13. for i in re['Quantity'][38:44]:
  14.     num += i
  15.     print(num)
  16. # #b
  17. print(sum(re['Quantity'][38:44]))
  18.  
  19. # #6
  20. print(re['TotalPrice'][32:38].min())
  21.  
  22. #7
  23. print(re.sort_values('Category',ascending=False))
  24. #8
  25. print(re.iloc[16:25].sort_values('Category',ascending=False))
  26. #9
  27. print(re.iloc[20:27].sort_values(['Category','Product'],ascending =[0,1]))
  28. print(re.iloc[20:27].sort_values(['Category','Product'],ascending = [1,0]))
  29. print(re.iloc[20:27].sort_values(['Category','Product'],ascending = [1,1]))
  30. #10
  31. print(pd.read_excel("food.xlsx", "Restaraunts"))
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement