Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregate #97

Merged
merged 10 commits into from
Jul 3, 2024
Merged

Aggregate #97

merged 10 commits into from
Jul 3, 2024

Conversation

Pizza2Pizza
Copy link
Collaborator

@Pizza2Pizza Pizza2Pizza commented Jul 2, 2024

Aggregation to non-calendar periods #57
Added freq "QS-FEB","QS-MAR", etc, "AS-FEB", "AS-MAR" as allowed.
Defined aggregation rules between them


📚 Documentation preview 📚: https://portfolyo--97.org.readthedocs.build/en/97/

@Pizza2Pizza Pizza2Pizza self-assigned this Jul 2, 2024
@Pizza2Pizza Pizza2Pizza linked an issue Jul 2, 2024 that may be closed by this pull request
Copy link
Owner

@rwijtvliet rwijtvliet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments

@@ -14,7 +14,7 @@ def stamp(ts: pd.Timestamp, freq: str) -> tools_unit.Q_:
----------
ts : pd.Timestamp
Timestamp for which to calculate the duration.
freq : {{{', '.join(tools_freq.FREQUENCIES)}}}
freq : {{{tools_freq.ALLOWED_FREQUENCIES_DOCS}}}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we only need single (not tripple) braces

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

# assert_freq_valid(freq_source)
# assert_freq_valid(freq_target)
# Compare if the freq are the same
if freq_source == freq_target:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check after conversion to offset? (In case e.g. freqs are "QS" and "QS-JAN")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, also added case-test in tests

)


def up_or_down2(freq_source: str, freq_target: str) -> int:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we no longer have up_or_down, maybe we can rename this back to up_or_down? And move it down in the file, so assert_sufficiently_long is next to assert_sufficiently_short and assert_equally_long.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

# we are in the case QS and QS
return 0

raise ValueError
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a descriptive message raised with with error, so the user knows what he did wrong?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@rwijtvliet rwijtvliet merged commit 242936d into develop Jul 3, 2024
9 of 13 checks passed
@rwijtvliet rwijtvliet deleted the aggregate branch July 3, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[enhancement] Aggregation to non-calendar periods
2 participants