HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

Advanced Excel Filtering Across Workbooks Tutorial - Excel Automation with Python Series

51,187 views October 29, 2019 9:14

Watch on YouTube
ChannelDerrick Sherrill

Description from the creator

How to integrate excel workbooks and filter values across them using logical statements, loc method, and boolean series.

We'll cover:
- pandas merge
- pandas isin method
- python logical statements

Here's the spreadsheets if you want to use them yourself:
workbook_1.xlsx:
drive.google.com/open?id=1VIKlBY_Ql10Fd9EtLC3WS…
workbook_2.xlsx:
drive.google.com/open?id=1yaYREor6-Ij2NSe2XuLhJ…

#Python #Tutorial #ExcelAutomationWithPython
Let me know your requests!! I'll do my best to get them out as quickly as possible.

Thanks so much for the opportunity to provide videos to you all. You're all incredible - thank you for all your continued support (4,400+ subscribers at the time of writing) Thank you all.



*****************************************************************
Full code from the video:

import pandas as pd

# denote spreadsheets
excel_file_1 = 'Workbook_1.xlsx'
excel_file_2 = 'Workbook_2.xlsx'

#read in spreadsheets
df1 = pd.read_excel(excel_file_1)
df2 = pd.read_excel(excel_file_2)

#print columns
print(df1.columns)
print(df2.columns)

# Filter by conditions

print((df1['Name'].isin(df2['Name'])))

filtered_frame_1 = df1.loc[(df1['Name'].isin(df2['Name']))] # Based on another sheet

filtered_frame_2 = df1.loc[~(df1['Name'].isin(df2['Name']))] # Inverse

filtered_frame_3 = df1.loc[(df1['Name'].isin(df2['Name'])) & (df1['Interview Score'] == 4) | (df1['YR Experience'] == 3)] # Multiple Filters

all_frames = [df1, df2]
all_df = pd.merge(df1, df2, on='Name')
print(all_df)

filtered_frame_4 = all_df.loc[(all_df['YR Experience'] == 5) & (all_df['Group Interview Score'] == 4)]
print(filtered_frame_4)



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

Check out my website:
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!

About this tutorial

Derrick Sherrill published this 9:14 video tutorial on October 29, 2019. It has been watched 51,187 times on YouTube.

Duration
9:14
Published
October 29, 2019
Views
51,187
Likes
1,373

Tags

Share

This tutorial in other languages