Skip to content

Solution suggestion ofor problem with format_csv() method in orion/data.py #656

@jc4000

Description

@jc4000

Line 113 data['timestamp'] = df[timestamp_column_name].astype('int64').values

throws error if the df[timestamp_column_name] is in YYYY-MM-DD HH:MM:SS format. The typecast to int(64) doesn't work unless df[timestamp_column_name] the method pd.to_datetime() need to be used.

adding the following code chunk before line 113 resolves the problem.
if pd.to_datetime(df[timestamp_column_name], format='%Y-%m-%d %H:%M:%S', errors='coerce').notnull().all():
df[timestamp_column_name] = pd.to_datetime(df[timestamp_column_name], format='%Y-%m-%d %H:%M:%S')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions