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

Optimization fails with pandas 0.24 #171

Open
dhblum opened this issue Feb 26, 2019 · 1 comment
Open

Optimization fails with pandas 0.24 #171

dhblum opened this issue Feb 26, 2019 · 1 comment

Comments

@dhblum
Copy link
Collaborator

dhblum commented Feb 26, 2019

This issue is to address an error that occurs in the function JModelica._get_control_results(), where the control results are converted to a pandas series with datetime index. The error occurs because of the lines:

timeindex = self._global_start_time_utc + timedelta;
ts_opt = pd.Series(data = data, index = timeindex).tz_localize('UTC');

In pandas 0.22, the first line creates a timezone unaware timeindex. In pandas 0.24, it creates a timezone aware timeindex, causing the second line to fail with

TypeError: Already tz-aware, use tz_convert to convert.
@dhblum
Copy link
Collaborator Author

dhblum commented Apr 25, 2019

There are additional errors in exodata.py when dealing with DST and reading epw files:

Traceback (most recent call last):
  File "/home/dhbubu/git/mpcpy/MPCPy/unittests/test_optimization.py", line 526, in setUp
    weather.collect_data(start_time_exodata, final_time_exodata);
  File "/home/dhbubu/git/mpcpy/MPCPy/mpcpy/exodata.py", line 279, in collect_data
    self._collect_data(start_time, final_time);
  File "/home/dhbubu/git/mpcpy/MPCPy/mpcpy/exodata.py", line 811, in _collect_data
    self._read_timeseries_from_epw();
  File "/home/dhbubu/git/mpcpy/MPCPy/mpcpy/exodata.py", line 881, in _read_timeseries_from_epw
    time_ambiguous = pd.to_datetime(time_ambiguous.args[0].split("'")[1])
  File "/home/dhbubu/.local/lib/python2.7/site-packages/pandas/core/tools/datetimes.py", line 611, in to_datetime
    result = convert_listlike(np.array([arg]), box, format)[0]
  File "/home/dhbubu/.local/lib/python2.7/site-packages/pandas/core/tools/datetimes.py", line 302, in _convert_listlike_datetimes
    allow_object=True)
  File "/home/dhbubu/.local/lib/python2.7/site-packages/pandas/core/arrays/datetimes.py", line 1866, in objects_to_datetime64ns
    raise e
ValueError: (u'Unknown string format:', 'ambiguous')

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

No branches or pull requests

1 participant