Skip to content

Commit

Permalink
datetime-conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
kmax12 committed Apr 30, 2018
1 parent fbb081c commit e18949e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions featuretools/entityset/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,12 @@ def entityset_convert_variable_type(self, column_id, new_type, **kwargs):
elif new_type == vtypes.Datetime:
format = kwargs.get("format", None)
# TODO: if float convert to int?
df[column_id] = pd.to_datetime(df[column_id], format=format,
infer_datetime_format=True)
try:
df[column_id] = pd.to_datetime(df[column_id], format=format,
infer_datetime_format=True)
except:
raise Exception("Cannot convert column %s to %s" %
(column_id, new_type))
elif new_type == vtypes.Boolean:
map_dict = {kwargs.get("true_val", True): True,
kwargs.get("false_val", False): False,
Expand Down

0 comments on commit e18949e

Please sign in to comment.