https://github.com/zeutschler/datespan
Python library for date span parsing & management
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.1%) to scientific vocabulary
Repository
Python library for date span parsing & management
Basic Info
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
datespan
A Python package for effortless date span parsing and management. Aimed for data analysis and processing, useful in any context requiring date & time spans.
bash
pip install datespan
```python import pandas as pd from datespan import parse, DateSpan df = pd.DataFrame({"date": pd.date_range("2024-01-01", "2024-12-31")})
dss = parse("April 2024 ytd") # Create a DateSpanSet, same as 'DateSpanSet("April 2024 ytd")' dss.add("May") # Add full month May of the current year dss.add("today") # Add the current day from 00:00 to 23:59:59 dss += "previous week" # Add a full week from Monday 00:00 to Sunday 23:59:59 dss -= "January" # Remove full month January of the current year
print(len(dss)) # returns the number of contained nonconsecutive DateSpans print(dss.totuples()) # returns a list of (start, end) tuples representing the DateSpanSet print(dss.tosql("date")) # returns an SQL WHERE clause fragment print(dss.filter(df, "date")) # returns a DataFrame filtered by the DateSpanSet on column 'date' ```
Classes
DateSpan represents a single date or time span, defined by a start and an end datetime.
Provides methods to create, compare, merge, parse, split, shift, expand & intersect
DateSpan objects and /or datetime, dateor time objects.
DateSpanSet represents an ordered and redundancy free collection of DateSpan objects,
where consecutive or overlapping DateSpan objects get automatically merged into a single DateSpan
object. Required for fragmented date span expressions like every 2nd Friday of next month.
DateSpanParser provides parsing for arbitrary date, time and date span strings in english language,
ranging from simple dates like '2021-01-01' up to complex date span expressions like
'Mondays to Wednesday last month'. For internal DateTime parsing and manipulation, the
DateUtil library is used.
Part of the CubedPandas Project
The 'dataspan' package has been carved out from the CubedPandas project, a library for easy, fast & fun data analysis with Pandas dataframes, as DataSpan serves a broader scope and purpose and can be used independently of CubedPandas.
Bugs, Issues, Feature Requests
Please report any bugs, issues, feature requests, questions or feedback on the GitHub Issues page. It will be highly appreciated and will help to improve the package.
Documentation
Documentation will be available from 0.3.0 release on.
Owner
- Name: Thomas Zeutschler
- Login: Zeutschler
- Kind: user
- Location: Germany
- Company: BARC
- Website: www.barc.de
- Repositories: 7
- Profile: https://github.com/Zeutschler
Developer, Architect, Analyst and Advisor for Data, Analytics, AI & Cloud.
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Issues and Pull Requests
Last synced: 12 months ago
All Time
- Total issues: 0
- Total pull requests: 6
- Average time to close issues: N/A
- Average time to close pull requests: less than a minute
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 6
- Average time to close issues: N/A
- Average time to close pull requests: less than a minute
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- Zeutschler (5)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 74 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 9
- Total maintainers: 1
pypi.org: datespan
Effortless date span parsing and management.
- Homepage: https://github.com/Zeutschler/datespan
- Documentation: https://github.com/Zeutschler/datespan
- License: MIT License Copyright (c) 2024 Thomas Zeutschler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Latest release: 0.2.9
published over 1 year ago