-
Notifications
You must be signed in to change notification settings - Fork 71
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
improve solve_models() with tmin/tmax options #144
Conversation
implements partial solution for question in #141. |
Codecov Report
@@ Coverage Diff @@
## dev #144 +/- ##
==========================================
- Coverage 67.35% 67.15% -0.21%
==========================================
Files 31 31
Lines 3345 3355 +10
==========================================
Hits 2253 2253
- Misses 1092 1102 +10
Continue to review full report at Codecov.
|
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.
nice
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.
Nice indeed. I think this is a good way of implementing it. Could be made more general for all arguments passen on to ml.solve in the future.
This could in fact be made more general quite easily by checking the m_kwargs = {}
for key, value in kwargs.items():
if isinstance(value, pd.Series):
m_kwargs[key] = value.loc[ml_name]
else:
m_kwargs[key] = value
# Convert timestamps
for tstamp in ['tmin', 'tmax']:
if tstamp in m_kwargs:
m_kwargs[tstamp] = pd.Timestamp(m_kwargs[tstamp])
[...]
ml.solve(report=report, **m_kwargs) Also, is there any reason the new arguments are not forced to be passed as keywords (PEP 3102) since Python 3 is required anyway? |
Good suggestion! We also realized this was something we should eventually make more general, but since I only needed tmin/tmax at the moment, I got lazy. Feel free to submit a PR with this change, otherwise I'll implement your suggestion sometime later this week. |
No description provided.