Skip to content

Instantly share code, notes, and snippets.

@SyntaxError843
Last active December 13, 2021 20:18
Show Gist options
  • Save SyntaxError843/16966b61ebe9ca377a2f6e3b1f9e46a3 to your computer and use it in GitHub Desktop.
Save SyntaxError843/16966b61ebe9ca377a2f6e3b1f9e46a3 to your computer and use it in GitHub Desktop.
import pandas as pd
from time import time
from datetime import datetime
df = pd.read_excel(r'./cvs.xlsx')
accepted_keywords = ( 'python', )
accepted_regions = ( 'jbeil', 'beirut', 'batroun' )
accepted_mail_domains = ( 'gmail', 'outlook' )
accepted_age = ( 20, 40 )
accepted_cvs = []
for index, row in df.iterrows() :
accepted = False
experience = row['Experience'].lower()
skills = row['Skills'].lower()
region = row['Region'].lower()
contact = row['Contact Information'].lower()
age = int( ( time() - row['Birth Date'].timestamp() ) / 31556926 )
for accepted_keyword in accepted_keywords :
if ( accepted_keyword in ( skills + experience ) ) :
accepted = True
break
if ( accepted ) :
accepted = False
for accepted_region in accepted_regions :
if ( accepted_region in ( region ) ) :
accepted = True
break
if ( accepted ) :
accepted = False
for accepted_mail_domain in accepted_mail_domains :
if ( accepted_mail_domain in ( contact ) ) :
accepted = True
break
if ( accepted ) :
accepted = False
if ( accepted_age[0] <= age <= accepted_age[1] ) :
accepted = True
if ( accepted ) :
accepted_cvs.append([
row['First Name'],
row['Last Name'],
row['Experience'],
row['Region'],
row['Hobbies'],
row['Education'],
row['Contact Information'],
row['Birth Date'].strftime("%d/%m/%Y"),
row['Skills'],
])
df_to_store = pd.DataFrame(
accepted_cvs,
columns = [
'First Name',
'Last Name',
'Experience',
'Region',
'Hobbies',
'Education',
'Contact Information',
'Birth Date',
'Skills',
]
)s
df_to_store.to_excel( r'./accepted_cvs.xlsx' )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment