Data Science · मराठी आवृत्ती
10.2 IST timezone लावूया
या sample मधले timestamps आधीपासून IST मधले आहेत, पण timezone label नाही. अशा naive timestamps ना Asia/Kolkata जोडूया:
# Localise naive timestamps as IST, then optionally convert
df["order_ts"] = df["order_ts"].dt.tz_localize("Asia/Kolkata")
print(df["order_ts"])
df["date"] = df["order_ts"].dt.date
df["hour"] = df["order_ts"].dt.hour
df["month"] = df["order_ts"].dt.month
df["weekday"] = df["order_ts"].dt.day_name()
15-10-2026 19:40 या काल्पनिक Nashik order मधून hour 19 मिळतो. पुढे evening demand चा heatmap बनवताना तो उपयोगी पडतो.
Course मधला Diwali rush हा काल्पनिक teaching tag आहे; या date वरून प्रत्यक्ष दिवाळीची calendar date ठरवू नका. तसेच UTC वेळ असेल तर तिला थेट IST label लावू नका; मूळ timezone लावून tz_convert करा.