Skip to content

Instantly share code, notes, and snippets.

View rsalaza4's full-sized avatar
🎯
Focusing

Roberto Salazar rsalaza4

🎯
Focusing
View GitHub Profile
# Build seaborn replot
g = sns.relplot(
data=data,
x="Replicate",
y="Value",
hue="Operator",
style="Operator",
col="Part",
col_wrap=5,
aspect=0.7
# Add Replicate column
data["Replicate"] = list(np.arange(1, data["Part"].value_counts()[1]+1))*(int(len(data["Part"])/data["Part"].value_counts()[1]))
# Display top rows
data.head()
# Import libraries and dependencies
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
# Open Excel file
data = pd.read_excel("msa_2_crossed.xlsx")
First name: Roberto
Last name: Salazar
Email address: rsalaza4@binghamton.edu
Universities: ['Northwestern University', 'State University of New York at Binghamton']
# Print results
print(f"First name: {myResume.firstName}")
print(f"Last name: {myResume.lastName}")
print(f"Email address: {myResume.emailAddress}")
print(f"Universities: {myResume.universities}")
# Instantiate myResume variable
myResume = Resume(text)
# Obtain resume information
myResume.get_first_name()
myResume.get_last_name()
myResume.get_email()
myResume.get_univerisities()
class Resume:
def __init__(self, text):
self.text = text
self.firstName = ""
self.lastName = ""
self.emailAddress = ""
self.universities = []
def get_first_name(self):
# Define multiple universities names patterns
sub_patterns = [
'[A-Z][a-z]* [A-Z][a-z]* [A-Z][a-z]* University of [A-Z][a-z]* [A-Z][a-z]* at [A-Z][a-z]* [A-Z][a-z]*',
'[A-Z][a-z]* [A-Z][a-z]* [A-Z][a-z]* University of [A-Z][a-z]* [A-Z][a-z]* at [A-Z][a-z]*',
'[A-Z][a-z]* [A-Z][a-z]* [A-Z][a-z]* University of [A-Z][a-z]* at [A-Z][a-z]* [A-Z][a-z]*',
'[A-Z][a-z]* [A-Z][a-z]* [A-Z][a-z]* University of [A-Z][a-z]* at [A-Z][a-z]*',
'[A-Z][a-z]* [A-Z][a-z]* [A-Z][a-z]* University of [A-Z][a-z]* [A-Z][a-z]*',
'[A-Z][a-z]* [A-Z][a-z]* [A-Z][a-z]* University of [A-Z][a-z]*',
def get_email(self):
# Find all strings that follow emails conventions
match = re.search(r'[\w.+-]+@[\w-]+\.[\w.-]+', self.text)
# Assign word to email address
self.emailAddress = match.group(0)
def get_last_name(self):
# Split resume text and store up to the first 10 words one position after the index of the string where the first name was found
firstWords = self.text.split()[self.text.split().index(self.firstName)+1:10]
# Loop through the first 10 words
for word in firstWords:
# Validate that the word is not a digit and
# Validate that the character is an uppercase letter and