Skip to content

amaralbf/dateint

Repository files navigation

dateint

ci-status Coverage PYPI MIT License Code Style Black

Helper library for manipulation of formatted date/datetime values

It's very common to store date/datetimes as integers or strings using formats such as YYYYmmdd or YYYYmm. In python, to perform date/datetime arithmetic on those values, one needs to:

  1. convert the original value to date or datetime
  2. perform the date/datetime operation
  3. convert the result back to the original format

With dateint, we abstract all convertion operations so you can focus on the arithmetic step:

  • single value:

    import dateint as di
    
    di.add(20220510, days=15)
    # 20220525
  • pandas:

    import dateint as di
    import pandas as pd
    
    dates = pd.Series([202201, 202202, 202203])
    
    di.add(dates, months=2)
    '''
    0    202203
    1    202204
    2    202205
    dtype: int64
    '''

Documentation

See the documentation page for the complete and detailed documentation.

Installation

pip install dateint

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages