forked from Derrick-Sherrill/DerrickSherrill.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutomateExcelReporting.py
More file actions
33 lines (22 loc) · 844 Bytes
/
Copy pathAutomateExcelReporting.py
File metadata and controls
33 lines (22 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'''
Video Tutorial: https://youtu.be/1Kcco6koC34
Description: Better Techniques to automate excel reporting using pandas and python.
'''
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
excel_file_1 = 'shift-data.xlsx'
excel_file_2 = 'third-shift-data.xlsx'
df_first_shift = pd.read_excel(excel_file_1, sheet_name='first')
df_second_shift = pd.read_excel(excel_file_1, sheet_name='second')
df_third_shift = pd.read_excel(excel_file_2)
print(df_first_shift)
print(df_first_shift['Product'])
df_all = pd.concat([df_first_shift, df_second_shift, df_third_shift])
print(df_all)
pivot = df_all.groupby(['Shift']).mean()
shift_productivity = pivot.loc[:,"Production Run Time (Min)":"Products Produced (Units)"]
print(shift_productivity)
#shift_productivity.plot(kind='bar')
#plt.show()
df_all.to_excel("output.xlsx")