Conversation
suvayu
commented
Jan 30, 2025
Contributor
- low_res_datetime
- make package pipeable
- add tests
suvayu
commented
Jan 30, 2025
|
|
||
| You can check the available ranges with `pd.Timestamp.min` and `pd.Timestamp.max`. | ||
| """ | ||
| period_parts = re.search(r'^([0-9]+) *(.*)$', freq).groups() |
Contributor
Author
There was a problem hiding this comment.
Check for match, if no match returns None. Should raise a error message then
| """ | ||
| period_parts = re.search(r'^([0-9]+) *(.*)$', freq).groups() | ||
| if len(period_parts) != 2: | ||
| raise ValueError("Can't analyze period \"{period}\".") |
Contributor
Author
There was a problem hiding this comment.
Error message is not specific. Say what is the problem, like couldn't separate number from unit, etc.
| period_parts = re.search(r'^([0-9]+) *(.*)$', freq).groups() | ||
| if len(period_parts) != 2: | ||
| raise ValueError("Can't analyze period \"{period}\".") | ||
| number_str, unit = period_parts |
Contributor
Author
There was a problem hiding this comment.
maybe merge with above and catch ValeuError
| freq_pd = pd.Timedelta(freq_np) | ||
| #print(f"freq_pd: {freq_pd}") | ||
|
|
||
| date_array = np.arange(start_date_np, start_date_np + periods * freq_pd, freq_pd) |
Contributor
Author
There was a problem hiding this comment.
Have a look at pd.date_range, maybe it has the same behaviour, but code would be simpler.
pandas.DateOffset is similar to relative delta
Arrays in the absense of "value_type" default to "float" (as per the docs), here the data is text string, not convertible to a number.
- minute is abbreviated as min - convert freq to int before passing to DateOffset
Refactor the module w/ conditional imports to use Pydantic for schema generation (invoked as `python -m models.py json-blob-schema.json`), but use plain Python definitions when used as a module. Update the JSON schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.