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.

Proposal: a new nullable Timestamp data type with support for non-ns resolutions

See original GitHub issue

Motivation for this proposal: for full dtype support with nullable dtypes, we also need a nullable version of the datetime-like dtypes. For backwards compatibility, we need a new dtype (like we did for the other nullable dtypes), and that’s what the proposal below is describing. And when creating a new dtype, I think it is the perfect opportunity to have a different default for the resolution (eg microsecond unit instead of nanosecond).

Summary: This proposal puts forward a new TimestampDtype, a nullable extension dtype to hold timestamp data:

  • A new timestamp data type that follows the pattern of the nullable dtypes (e.g. integer, boolean) with consistent missing value behaviour.
  • A parameterized data type with support for multiple resolutions (from seconds through nanoseconds) and optionally time zones (unifying the tz-naive and tz-aware dtypes into a single ExtensionDtype).
  • The new data type can have a better default resolution (e.g. microseconds instead of nanoseconds).
  • I suggest using “timestamp” for the dtype name, because 1) we need a different name to differentiate from “datetime64” anyway and 2) this is then internally consistent with our Timestamp scalar. But an alternative could also be “Datetime64” (capitalized).

Full version at https://docs.google.com/document/d/1uCdxjlYAafdHD7f57kpkPsJV2Q9Oaxkg1a8V5steMBM/edit?usp=sharing

This would address #7307

Small illustrative code snippet:

>>> s
0   2020-01-01 00:00:00
1                  <NA>
2   2020-01-01 02:00:00
dtype: timestamp[us]

>>> s_tz
0   2020-01-01 00:00:00+01:00
1   2020-01-01 01:00:00+01:00
2   2020-01-01 02:00:00+01:00
dtype: timestamp[ns, tz=Europe/Brussels]

Looking forward to your thoughts / comments.

cc @pandas-dev/pandas-core @pandas-dev/pandas-triage

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:24 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
jbrockmendelcommented, Aug 22, 2021

side-note: a PR that changed Period.__richcmp__ checking for freq equality from self.freq != other.freq to self.freq._period_dtype_code != other.freq._period_dtype_code would likely improve the performance there quite a bit

1reaction
jbrockmendelcommented, Aug 2, 2021

What’s the current status on this?

I’m planning to implement this once we are able to use cython 3

Read more comments on GitHub >

github_iconTop Results From Across the Web

mysql - Invalid default value for 'create_date' timestamp field
I had this problem when I trie migrating a wordpress site to another server (both local) and it would not let me import...
Read more >
Solved: timestamp not supported in HIVE - Cloudera Community
Hi,. Data is in files in the following format 2019-06-15T15:43:12 ( yyyy-MM-ddThh:mm:ss ). When I do a select * on the table ,...
Read more >
Release notes for Watson Assistant - IBM Cloud Docs
Use these release notes to learn about the latest updates to IBM Watson™ ... The new format is yyyy-MM-dd HH:mm:ss 'GMT'XXX (where XXX...
Read more >
Nonn's | Flooring, Bathroom and Kitchen in Madison, New ...
Nonn's wants to re-ignite your passion for every room in your home. Each of our four boutique showrooms is tailored to help you...
Read more >
Error and Warning Dictionary | Twilio
Field definition type is invalid; data types that are supported are text, date, and number ... The Messaging Service is not available to...
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