Skip to content

Instantly share code, notes, and snippets.

@rsalaza4
Last active January 17, 2025 15:50
Show Gist options
  • Select an option

  • Save rsalaza4/b463e4b95c96cb30a1f0950f399132ea to your computer and use it in GitHub Desktop.

Select an option

Save rsalaza4/b463e4b95c96cb30a1f0950f399132ea to your computer and use it in GitHub Desktop.
# 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
df['OrderCreatedLocalDateTime'] = pd.to_datetime(df['OrderCreatedLocalDateTime'])
# Calculate TimeOutOfQueue column
OrderCreatedORSTTime_column = []
for i in range(len(df)):
OrderCreatedORSTTime_column.append(df.iloc[i]['OrderCreatedLocalDateTime'] + datetime.timedelta(seconds=int(df.iloc[i]['OrderProcessingTime'])))
df['TimeOutOfQueue'] = OrderCreatedORSTTime_column
# Visualize top rows
df.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment