Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli authored Oct 11, 2023
1 parent bd0cf0d commit 3dedd16
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
# Polars-business

![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)
<h1 align="center">
<img
width="400"
alt="polars-business"
src="https://github.com/MarcoGorelli/polars-business/assets/33491632/a743c3bd-3653-4362-a6bf-0984b8873e20">
</h1>

Business day utilities for [Polars](https://www.pola.rs/).

Install with `pip install polars-business-day-tools`.
Installation
------------

First, you need to install Polars. See the link above for how to do that.

Then, you'll need to install `polars-business`. Currently, you can do this via PyPI (note: the `$` is not part of the command):
```console
$ pip install polars-business
```

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
import polars_business

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)))
print(df.with_columns(dates_shifted=pl.col('dates').business.advance_by_days(n=5)))
```

0 comments on commit 3dedd16

Please sign in to comment.