A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/18705 below:

Timestamp("now") should match to_datetime("now") · Issue #18705 · pandas-dev/pandas · GitHub

See #17697, #18666

pd.to_datetime('now') returns the current UTC time, while pd.Timestamp('now') returns the current local time. pd.to_datetime('today') rounds the current UTC time down to midnight, while pd.Timestamp('today') returns the current local time (not rounded down). These should be fixed to follow a single convention.

>>> pd.Timestamp('now')
Timestamp('2017-12-09 12:28:31.642416')
>>> pd.to_datetime('now')
Timestamp('2017-12-09 20:28:35')
>>> pd.Timestamp('today')
Timestamp('2017-12-09 12:28:49.263407')
>>> pd.to_datetime('today')
Timestamp('2017-12-09 00:00:00')

AFAICT the to_datetime behavior was designed to match the behavior of np.datetime64('now') and np.datetime64('today'). The Timestamp behavior matches the special constructors Timestamp.now(), Timestamp.today(). At this point I think the least disruptive change would be to make Timestamp(...) behave like to_datetime(...).

Thoughts?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4