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/8158 below:

convert datetime components (year, month, day, ...) in different columns to datetime · Issue #8158 · pandas-dev/pandas · GitHub

from SO

I didn't find an issue about this, but it has come up some times at stackoverflow: having columns with integers for year, month, day, hour, ..., how do you convert this to a datetime column/index ?

http://stackoverflow.com/questions/19350806/how-to-convert-columns-into-one-datetime-column-in-pandas

You have the typical solution of adding the columns: pd.to_datetime((df['Y']*10000 + df['M']*100 + df['D']).astype('int'), format='%Y%m%d'), and @unutbu added now a faster solution using numpy's different datetime64 resolutions to that question on SO.

I personally think this would be a nice addition to pandas to have a more native solution for this. But then we need to figure out a nice API. Or we keep it as is, but try to document it more (add as example to docs?)


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