Datasets:
Download source/tests/solvers/tx_dates.py from Syndicate604/skills-desk: direct link, hf CLI and curl.
- Browser
- Download file 452 Bytes
-
https://huggingface.co/datasets/Syndicate604/skills-desk/resolve/main/source/tests/solvers/tx_dates.py
- Command line
-
hf download hf://datasets/Syndicate604/skills-desk/source/tests/solvers/tx_dates.py
-
curl -L -o tx_dates.py https://huggingface.co/datasets/Syndicate604/skills-desk/resolve/main/source/tests/solvers/tx_dates.py
452 Bytes
| import csv | |
| from datetime import datetime | |
| fmt = {"uk_branch": "%d/%m/%Y", "us_branch": "%m/%d/%Y"} | |
| w = csv.writer(open("receipts_iso.csv", "w", newline="")); w.writerow(["receipt", "date"]) | |
| for r in csv.DictReader(open("receipts.csv")): | |
| t = r["date"] | |
| if r["source"] in fmt: d = datetime.strptime(t, fmt[r["source"]]) | |
| else: d = datetime.strptime(t, "%Y-%m-%d" if "-" in t else "%d %b %Y") | |
| w.writerow([r["receipt"], d.date().isoformat()]) | |