File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -106,3 +106,4 @@ v0.2.6:
106106 2023-05-24 -- Use token for PyPi in Makefile
107107v0.2.7b1:
108108 2025-03-01 -- https://github.com/hapi-server/client-python/issues/76
109+ 2025-03-01 -- https://github.com/hapi-server/client-python/issues/78
Original file line number Diff line number Diff line change @@ -272,7 +272,8 @@ def hapitime2datetime(Time, **kwargs):
272272
273273 try :
274274 # This is the fastest conversion option. But it will fail on YYYY-DOY
275- # format and other valid ISO 8601 dates such as 2001-01-01T00:00:03.Z
275+ # format and other valid^* ISO 8601 dates such as 2001-01-01T00:00:03.Z
276+ # ^*Maybe not: https://github.com/hapi-server/client-python/issues/76
276277 # When infer_datetime_format is used, a TimeStamp object returned,
277278 # which is the reason for the to_pydatetime() call. (When format=... is
278279 # used, a datetime object is returned.)
@@ -281,7 +282,11 @@ def hapitime2datetime(Time, **kwargs):
281282 # is the reason for the call to tz_convert(tzinfo).
282283 # TODO: Use hapitime_format_str() and pass this as format=...
283284 Timeo = Time [0 ]
284- Time = pandas .to_datetime (Time , infer_datetime_format = True ).tz_convert (tzinfo ).to_pydatetime ()
285+ pandas_major_version = int (pandas .__version__ .split ('.' )[0 ])
286+ if pandas_major_version < 2 :
287+ Time = pandas .to_datetime (Time , infer_datetime_format = True ).tz_convert (tzinfo ).to_pydatetime ()
288+ else :
289+ Time = pandas .to_datetime (Time ).tz_convert (tzinfo ).to_pydatetime ()
285290 if reshape :
286291 Time = np .reshape (Time , shape )
287292 toc = time .time () - tic
You can’t perform that action at this time.
0 commit comments