Here's the basic data content!
I classified the data above by date and time
df4 = pd.pivot_table (df, index=["month-to-month", day-to-month", parking time zone", values=["count"], aggfunc=np.sum)
Results
It came out as above
Date not in the data (ex-2021-01-02) and time zone not in the data (ex - January 1, 2021 2 hours, 3 hours, 4 hours...etc.)
All dates for 1 year and
I'd like to classify it as less than an hour per day, 1 hour, 2 hours, 3 hours ------12 hours, 13 hours or more
Expected Results
If I were you, I'd make a column called "Parking Time Category" in the original df first.
def time zone to time zone category (time zone):
If "min" in time zone: return "less than 1 hour"
n = int (time zone.split ("time") [0])
if > 12: return "more than 13 hours"
Return time zone
df["Park Time Category"] = df["Park Time Zone"].apply (time to time category)
© 2025 OneMinuteCode. All rights reserved.