Separate Excel Data into Workbooks by Column Values - Python Pandas Tutorial

Veröffentlicht am: 08 Januar 2020
auf dem Kanal: Derrick Sherrill
43,003
1.4k

Hey Everyone! In this one we'll talk a look at how we can break down a workbook into multiple other workbooks depending ont he value inside a column.

We do it here for all unique values in one of our columns, but you could do the conditional indexing any way you like. I hope this shows you the baseline of how to do it!

Support the Channel on Patreon --
  / derricksherrill  
Join The Socials --
Reddit -   / codewithderrick  
FB -   / codewithderrick  
Insta -   / codewithderrick  
Twitter -   / codewithderrick  
LinkedIn -   / derricksherrill  
GitHub - https://github.com/Derrick-Sherrill
*****************************************************************
Workbook -
https://drive.google.com/file/d/12p1q...

Full code from the video:
import pandas as pd

excel_file_path = 'training_status.xlsx'

df = pd.read_excel(excel_file_path)
print(df)

split_values = df['Shift'].unique()
print(split_values)

for value in split_values:
df1 = df[df['Shift'] == value]
output_file_name = "Shift_" + str(value) + "_Trainings.xlsx"
df1.to_excel(output_file_name, index=False)

https://github.com/Derrick-Sherrill/D...

Packages (& Versions) used in this video:
Pandas 0.25.0
Python 3.8

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

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!!

--- Channel FAQ --

What text editor do you use?
Atom - https://atom.io/

What Equipment do you use to film videos?
https://www.amazon.com/shop/derricksh...

What editing software do you use?
Adobe CC - https://www.adobe.com/creativecloud.html
Premiere Pro for video editing
Photoshop for images
After Effects for animations

Do I have any courses available?
Yes & always working on more!
https://www.udemy.com/user/derrick-sh...

Where do I get my music?
I get all my music from the copyright free Youtube audio library
https://www.youtube.com/audiolibrary/...

Let me know if there's anything else you want answered!

-------------------------

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


Auf dieser Seite können Sie das Online-Video Separate Excel Data into Workbooks by Column Values - Python Pandas Tutorial mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Derrick Sherrill 08 Januar 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 43,003 Mal angesehen und es wurde von 1.4 tausend den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!