python - How do I convert dates into ISO-8601 DateTime format in a Pandas dataframe -
i have dataframe below (using python/pandas) , wish convert the
q_string q_visits q_date red 1790 02/10/2012 00:00 blue 364 02/10/2012 00:00 current 280 02/10/2012 00:00 molecular 259 02/10/2012 00:00 cell 201 02/10/2012 00:00 how can convert 'q_date' field so-8601 datetime format (yyyy-mm- ddthh:mm:ssz)?
thanks in advance.
use pandas datetools parser parse date , format using standard python strftime function.
>>> df['q_date'].apply( lambda x: pd.datetools.parse(x).strftime('%y%m%dt%h:%m%sz')) 0 20120210t00:0000z 1 20120210t00:0000z 2 20120210t00:0000z 3 20120210t00:0000z 4 20120210t00:0000z name: q_date, dtype: object
Comments
Post a Comment