Last active
January 17, 2025 15:50
-
-
Save rsalaza4/b463e4b95c96cb30a1f0950f399132ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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