Skip to content

Commit

Permalink
pull request merged
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Pelaez-Zapata committed Dec 5, 2024
1 parent ddb7e08 commit b27fbea
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ewdm/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,22 @@ def read_dataset(self):
self.fname, names=columns, header=None, skiprows=1
)


# Format the 'msec' column to be three digits
# format the 'msec' column to be three digits
data['msec'] = data['msec'].apply(lambda x: f'{int(x):03}')
# print(data['msec'])

# Combine the desired date-time columns and convert them to datetime
# Here, we concatenate the time components and ensure the millisecond part is correctly formatted
# combine the desired date-time columns and convert them to datetime
# here, we concatenate the time components and ensure the
# millisecond part is correctly formatted
data["time"] = pd.to_datetime(
data['year'].astype(str) + '-' +
data['month'].astype(str) + '-' +
data['day'].astype(str) + ' ' +
data['hour'].astype(str) + ':' +
data['min'].astype(str) + ':' +
data['sec'].astype(str) + '.' +
data['msec'], # Concatenate using three-digit milliseconds
format="%Y-%m-%d %H:%M:%S.%f" # Use .%f to parse the millisecond part
data['msec'], # concatenate using three-digit milliseconds
format="%Y-%m-%d %H:%M:%S.%f" # use .%f to parse the millisec part
)

data = data.drop(columns=columns[:7])
Expand Down

0 comments on commit b27fbea

Please sign in to comment.