Skip to content

Instantly share code, notes, and snippets.

View rsalaza4's full-sized avatar
🎯
Focusing

Roberto Salazar rsalaza4

🎯
Focusing
View GitHub Profile
# Create heatmap
sns.heatmap(minutes_df.groupby([minutes_df['Business Date'].dt.date, minutes_df['Business Date'].dt.strftime('%H:00')])
['Orders'].mean()
.rename_axis(index=['Date','Hour'])
.unstack(level=0),
cmap='coolwarm'
)
# Add title
plt.title('Customers in Queue Over Time')
# Initialize date ranges list
date_ranges_list = []
# Loop through all the orders placed on the source file
for i, row in df.iterrows():
# Get Start/End Time
enter_t = row["OrderCreatedLocalDateTime"].replace(second=0, microsecond=0)
exit_t = row["TimeOutOfQueue"].replace(second=0, microsecond=0)
# Calculate timeframe from input file on a minute basis
# If the timespan from the source file is less than a day
if (pd.to_datetime(df.iloc[-1,0]) - pd.to_datetime(df.iloc[0,0])).days == 0:
timeframe = pd.date_range(
df.iloc[0,0],
periods=60*24,
freq='1min'
)
# If the timespan from the source file is more than a day
else:
# Import libraries and dependencies
import datetime
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Read csv file
df = pd.read_csv('orders.csv')
# Convert OrderCreatedLocalDateTime column to datetime type
# 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: [email protected]
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()