question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Display datetime64 arrays without showing local timezones

See original GitHub issue

NumPy has an unfortunate way of adding local timezone offsets when printing datetime64 arrays:

<xray.DataArray 'time' (time: 4000)>
array(['1999-12-31T16:00:00.000000000-0800',
       '2000-01-01T16:00:00.000000000-0800',
       '2000-01-02T16:00:00.000000000-0800', ...,
       '2010-12-10T16:00:00.000000000-0800',
       '2010-12-11T16:00:00.000000000-0800',
       '2010-12-12T16:00:00.000000000-0800'], dtype='datetime64[ns]')
Coordinates:
  * time       (time) datetime64[ns] 2000-01-01 2000-01-02 2000-01-03 ...

We should use custom formatting code to remove the local timezone (to encourage folks just to use naive timezones/UTC).

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
shoyercommented, Apr 21, 2016

The good news is that I fixed this display bug upstream in NumPy 1.11, which came out last month. If you upgrade to NumPy 1.11, datetimes are always treated as timezone naive. So I think we can actually consider this issue fixed.

0reactions
andreas-hcommented, Apr 21, 2016

sounds good to me, @sjpfenninger, but I don’t know the internals …

Read more comments on GitHub >

github_iconTop Results From Across the Web

convertion of datetime to numpy datetime without timezone info
I think there are 2 issues - how the datetime.datetime object is converted to np.datetime64 , and how the later is displayed.
Read more >
Decoding time and timezones with datetime64[ns]
My computer happens to be set to UTC-4. I'm not sure how to go about telling xray to ignore the local timezone when...
Read more >
Datetimes and Timedeltas — NumPy v1.24 Manual
Starting in NumPy 1.7, there are core array data types which natively support datetime functionality. The data type is called datetime64 , so...
Read more >
pandas.Series.dt.tz_convert — pandas 1.5.2 documentation
Convert tz-aware Datetime Array/Index from one time zone to another. Parameters ... A tz of None will convert to UTC and remove the...
Read more >
Converting time zone in Microsoft Power Automate
Provides a solution to an issue where you find a datetime in the wrong time zone.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found