-
Notifications
You must be signed in to change notification settings - Fork 0
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
Pandas fix #99
Pandas fix #99
Conversation
commented out problematic script
portfolyo/tools/unit.py
Outdated
# Convert all values to same unit. | ||
units = fr.values[0].units | ||
magnitudes = [v.to(units).magnitude for v in fr.values] | ||
return pd.Series(magnitudes, fr.index, dtype=f"pint[{units}]") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
portfolyo/tools/freq.py
Outdated
@@ -9,7 +9,7 @@ | |||
|
|||
|
|||
# Allowed frequencies. | |||
ALLOWED_FREQUENCIES_DOCS = "'15T' (=quarterhour), 'H', 'D', 'MS', 'QS' (or 'QS-FEB', 'QS-MAR', etc.), or 'AS' (or 'AS-FEB', 'AS-MAR', etc.)" | |||
ALLOWED_FREQUENCIES_DOCS = "'15T' (=quarterhour), 'H', 'D', 'MS', 'QS' (or 'QS-FEB', 'QS-MAR', etc.), or 'YS' (or 'AS-FEB', 'AS-MAR', etc.)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YS-FEB, YS-MAR
docs/specialized_topics/dataprep.rst
Outdated
@@ -71,7 +71,7 @@ Frequency | |||
|
|||
The index must have a frequency (``fr.index.freq``) and it must be a valid frequency. To check validity of the frequency, one may use ``portfolyo.assert_freq_valid()``. The following abbreviations are used by ``pandas`` and throughout this package: | |||
|
|||
* ``15T``: quarterhourly; | |||
* ``15min``: quarterhourly; | |||
* ``H``: hourly; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be lowercase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oi, you meant 'H'
also, yes
portfolyo/core/pfstate/pfstate.py
Outdated
The frequency at which to resample. 'AS' for year, 'QS' for quarter, 'MS' | ||
(default) for month, 'D for day', 'H' for hour, '15T' for quarterhour. | ||
The frequency at which to resample. 'YS' for year, 'QS' for quarter, 'MS' | ||
(default) for month, 'D for day', 'H' for hour, '15min' for quarterhour. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pizza2Pizza: should 'H' be 'h'?
portfolyo/tools/freq.py
Outdated
@@ -251,8 +251,8 @@ def longest(*freqs: str) -> str: | |||
|
|||
Examples | |||
-------- | |||
>>> freq.longest('MS', 'H', 'AS', 'D') | |||
'AS' | |||
>>> freq.longest('MS', 'H', 'YS', 'D') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pizza2Pizza 'h'?
portfolyo/tools/freq.py
Outdated
@@ -231,7 +231,7 @@ def shortest(*freqs: str) -> str: | |||
|
|||
Examples | |||
-------- | |||
>>> freq.shortest('MS', 'H', 'AS', 'D') | |||
>>> freq.shortest('MS', 'H', 'YS', 'D') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pizza2Pizza 'h'?
Updated versions of pandas, pint and pint-pandas:
pandas = "^2.0"
pint = "^0.24"
pint-pandas = "0.6"
Updated functions due to internal changes of pint-pandas that distinguish between pandas Series with object data type and one with pint units
📚 Documentation preview 📚: https://portfolyo--99.org.readthedocs.build/en/99/