Created
January 15, 2022 14:59
-
-
Save chrisdmell/1be780817cdc1f777153a408fef48791 to your computer and use it in GitHub Desktop.
This file contains 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
groups = final_cleaned_df.groupby(["Bus","Service_Date_new"]).RecordedAt_new | |
min_val = groups.transform(min) | |
one_df = final_cleaned_df[(final_cleaned_df.RecordedAt_new==min_val) ] | |
one_df["date_diff"] = one_df.Service_Date_new - one_df.RecordedAt_new | |
figure(figsize=(10, 6), dpi=80) | |
plt.subplot(1, 2, 1) | |
plt.title("Date Difference Boxplot") | |
plt.boxplot(one_df.date_diff.astype('timedelta64[D]')) | |
plt.subplot(1, 2, 2) | |
plt.title("Date Difference Histogram") | |
plt.hist(one_df.date_diff.astype('timedelta64[D]')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment