Skip to content

Commit

Permalink
Fix for pandas 2.x (#103)
Browse files Browse the repository at this point in the history
* Fix pandas.to_datetime usage

* Allow backward compatibility

* Add changelog
  • Loading branch information
smithara committed Jan 17, 2024
1 parent ae1d8d0 commit 75c0c79
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions docs/release_notes.rst
Expand Up @@ -4,6 +4,11 @@ Release notes
Change log
----------

Changes from 0.11.4 to 0.11.5
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- Fix :py:meth:`viresclient.SwarmRequest.available_times` usage with pandas 2.x

Changes from 0.11.3 to 0.11.4
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
2 changes: 1 addition & 1 deletion src/viresclient/__init__.py
Expand Up @@ -35,4 +35,4 @@
from ._config import ClientConfig, set_token
from ._data_handling import ReturnedData, ReturnedDataFile

__version__ = "0.11.4"
__version__ = "0.11.5"
8 changes: 6 additions & 2 deletions src/viresclient/_client.py
Expand Up @@ -671,6 +671,10 @@ def available_times(self, collection, start_time=None, end_time=None):
response = self._get(request, asynchronous=False, show_progress=False)
df = read_csv(StringIO(str(response, "utf-8")))
# Convert to datetime objects
df["starttime"] = to_datetime(df["starttime"])
df["endtime"] = to_datetime(df["endtime"])
try:
df["starttime"] = to_datetime(df["starttime"], format="ISO8601")
df["endtime"] = to_datetime(df["endtime"], format="ISO8601")
except ValueError:
df["starttime"] = to_datetime(df["starttime"])
df["endtime"] = to_datetime(df["endtime"])
return df

0 comments on commit 75c0c79

Please sign in to comment.