python - Azure ML & Pandas: How to convert String to DateTime -
i've got dataset @ hand column of datetime in string format, eg.
a = 'tue sep 22 1998 00:00:00 gmt+0000 (coordinated universal time)'
and value column.
if use metadata editor in azure machine learning studio, won't work , complain can't conversion (from string datetime). guess it's format. i'm trying following:
a = str(a)[:10]+','+str(a)[10:15] #'tue sep 22, 1998'
now .net surely can conversion, mean method convert.todatetime(). however, when visualized output of python script, found string has been changed 'tue sep 22, 1998 none,', quite weird. knows what's wrong it? i'm attaching excerpt of python code down below:
def azureml_main(dataframe1 = none, dataframe2 = none): dataframe1['timestamp'] = dataframe1['timestamp'].apply(lambda a: str(a)[:10]+','+str(a)[10:15]) return dataframe1,
i use python date format normalization. have change string before returning dataframe because underlying r thrown exception
def azureml_main(dataframe1 = none, dataframe2 = none): import pandas pd dates = pd.to_datetime(dataframe1['date']) dates = dates.apply(lambda x: x.strftime('%y-%m-%d')) dataframe1['date'] = dates return dataframe1,
then use metadata editor change type datetime
Comments
Post a Comment