Home Machine learning ARTIFICIAL INTELLIGENCE Automate Excel Pivot Tables Across Workbooks – Learn Python Pandas

Automate Excel Pivot Tables Across Workbooks – Learn Python Pandas

49
0



Hey Everyone! Continuing the Pandas series. In this one we’ll work with multiple spreadsheets and use the GroupBy pandas function.

We’ll cover:
– Combining data sources
– Grouping data from multiple sources

#Python #Pandas #FiveMinutePythonScripts

Thanks so much for all the support! You all are incredible. Everything I type this message in my video descriptions it makes me smile. 3930+ Subscribers! How awesome – Thank you all 🙂

*****************************************************************
The Excel Sheets I used (Just dummy data):
Workbook1.xlsx –
https://drive.google.com/open?id=1a11pvERd-Z9oy5nGXDJK-bDwOMiDhRTc

A second (optional workbook with same data structure) –
https://drive.google.com/file/d/1os_vUINGjx8_NPv7S0BzeYuMp7GMDU37/view?usp=sharing

Full code from the video:
import pandas as pd

excel_file = ‘Workbook1.xlsx’

df_1 = pd.read_excel(excel_file)
df_2 = pd.read_excel(excel_file, sheet_name=’2nd’)

print(df_1.head(5))
print(df_2.head(5))

frames = [df_1, df_2]
all_data_df = pd.concat(frames, axis=0)
print(all_data_df)

productivity_df = all_data_df.groupby([‘Operator’,’Line #’]).mean() #.min() .max() . sum()
print(productivity_df[‘Amount’])

*****************************************************************
Code from this tutorial and all my others can be found on my GitHub:
https://github.com/Derrick-Sherrill/DerrickSherrill.com

Check out my website:
https://www.derricksherrill.com/

If you liked the video – please hit the like button. It means more than you know. Thanks for watching and thank you for all your support!!

Always looking for suggestions on what video to make next — leave me a comment with your project! Happy Coding!

source

LEAVE A REPLY

Please enter your comment!
Please enter your name here