From a5c826dfc62207e8938d7693b685f465e0703d57 Mon Sep 17 00:00:00 2001 From: Marco Edward Gorelli Date: Wed, 11 Oct 2023 16:04:22 +0300 Subject: [PATCH] Update README.md --- README.md | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 4f48205..3f3c26d 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,23 @@ -# WIP +# Polars-business -Just sharing this try debugging something +![DALLĀ·E 2023-10-11 16 02 10 - polar bear in business suit](https://github.com/MarcoGorelli/polars-business-day-tools/assets/33491632/46575111-4d14-452b-ac98-548acab3cf8f) -Steps to reproduce: +Business day utilities for [Polars](https://www.pola.rs/). -1. make venv: `python3.11 -m venv .venv` -2. `.venv/bin/activate` -3. `pip install maturin polars` -4. `cd src` -5. `maturin develop -m polars_business_day_tools/Cargo.toml ` -6. `python run.py` +Install with `pip install polars-business-day-tools`. + +Example +------- + +Here's an example of how to shift a date range forwards by 5 business days (i.e. Monday to Friday, excluding weekends): +```python +import polars as pl +from polars_business_day_tools import BusinessDayTools +from datetime import date + +df = pl.DataFrame({ + "dates": pl.date_range(date(2000, 1, 1), date(9999, 1, 1), eager=True), +}) + +print(df.with_columns(dates_shifted=pl.col('dates').bdt.advance_by_days(n=5))) +```