import pandas as pd orders = pd.DataFrame( { "order_id": [1001, 1002, 1003, 1004], "ordered_at": [ "2026-06-01 09:30", "2026-06-02 14:00", "not recorded", "2026-06-04 08:15", ], "shipped_at": [ "2026-06-01T17:45:00+08:00", "2026-06-02T07:10:00Z", "bad timestamp", "2026-06-04T12:00:00+08:00", ], } ) orders["ordered_at"] = pd.to_datetime( orders["ordered_at"], format="%Y-%m-%d %H:%M", errors="coerce", ) orders["shipped_at_utc"] = pd.to_datetime( orders["shipped_at"], errors="coerce", utc=True, ) print(f"pandas {pd.__version__}") print() print(orders.filter(["order_id", "ordered_at", "shipped_at_utc"]).to_string(index=False)) print() print(orders.filter(["ordered_at", "shipped_at_utc"]).dtypes) print() print("parse failures") print(orders.loc[orders["ordered_at"].isna() | orders["shipped_at_utc"].isna(), ["order_id", "ordered_at", "shipped_at"]].to_string(index=False))