Guest User

Untitled

a guest
Jul 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. array = pd.DataFrame(np.object, index=[], columns=[])
  2. array = array.append({'Project': b.name, 'Summary': card.name,
  3. 'Key': card.id, 'Assignee': m, 'Points': s},
  4. ignore_index=True)
  5. array1 = pd.read_excel('ProjectCostUCP.xlsx', 'Лист1')
  6. result = array[['Project', 'Assignee', 'Points']].groupby(['Project',
  7. 'Assignee']).sum(axis=1)
  8. print(result.columns.tolist())
  9. result = result.merge(array1, on=['Project'])
  10. result['Value'] = result.Points * result.Price
  11. writer = pd.ExcelWriter('third.xlsx')
  12. array.to_excel(writer, "June")
  13. result.to_excel(writer, "June_agregation")
  14. writer.save()
  15.  
  16. Project Assignee Price Points Value
  17. srnd-demo Serhii 5,5 23 126,5
  18.  
  19. result = array[['Project', 'Assignee','Points']].groupby(['Project',
  20. 'Assignee']).sum(axis=1)
  21.  
  22. Points
  23. Project Assignee
  24. srnd-demo Serhii 23
  25.  
  26. Project Price
  27. srnd-demo 5.5
  28.  
  29. result.reset_index().merge(array1)
  30.  
  31. Project Assignee Price_x Points Price_y
  32. 0 srnd-demo Serhii 5.5 23.0 5.5
  33.  
  34. In [245]: result
  35. Out[245]:
  36. Points
  37. Project Assignee
  38. srnd-demo Serhii 23
  39.  
  40. In [246]: array1
  41. Out[246]:
  42. Project Price
  43. 0 srnd-demo 5.5
  44.  
  45. In [247]: result.reset_index().merge(array1)
  46. Out[247]:
  47. Project Assignee Points Price
  48. 0 srnd-demo Serhii 23 5.5
  49.  
  50. In [259]: result
  51. Out[259]:
  52. Points Price
  53. Project Assignee
  54. srnd-demo Serhii 23 5.5
  55.  
  56. In [260]: array1
  57. Out[260]:
  58. Project Price
  59. 0 srnd-demo 5.5
  60.  
  61. In [257]: result.reset_index().merge(array1, on='Project')
  62. Out[257]:
  63. Project Assignee Points Price_x Price_y
  64. 0 srnd-demo Serhii 23 5.5 5.5
  65.  
  66. In [258]: result.reset_index().merge(array1.drop(['Price'], axis=1), on='Project')
  67. Out[258]:
  68. Project Assignee Points Price
  69. 0 srnd-demo Serhii 23 5.5
Add Comment
Please, Sign In to add comment