Compare commits
1 Commits
76f8b194c4
...
edabcb57f8
Author | SHA1 | Date | |
---|---|---|---|
edabcb57f8 |
@ -152,10 +152,22 @@ def read_nasa_ames_as_dict(filename, instruments_dir: str = None, work_with_copy
|
||||
sep="\s+",
|
||||
header=header_length - 1,
|
||||
skip_blank_lines=True)
|
||||
|
||||
df['start_time'] = df['start_time'].astype(str).str.strip()
|
||||
df['end_time'] = df['end_time'].astype(str).str.strip()
|
||||
|
||||
df['start_time'] = pd.to_numeric(df['start_time'], errors='coerce')
|
||||
df['end_time'] = pd.to_numeric(df['end_time'], errors='coerce')
|
||||
|
||||
# Compute actual datetime from start_time and (if present) end_time
|
||||
df['start_time'] = df['start_time'].apply(lambda x: start_date + timedelta(days=x))
|
||||
df['start_time'] = df['start_time'].apply(
|
||||
lambda x: start_date + timedelta(days=x) if pd.notna(x) else pd.NaT
|
||||
)
|
||||
|
||||
if 'end_time' in df.columns:
|
||||
df['end_time'] = df['end_time'].apply(lambda x: start_date + timedelta(days=x))
|
||||
df['end_time'] = df['end_time'].apply(
|
||||
lambda x: start_date + timedelta(days=x) if pd.notna(x) else pd.NaT
|
||||
)
|
||||
|
||||
# Create header metadata dictionary
|
||||
header_metadata_dict = {
|
||||
|
Reference in New Issue
Block a user