Skip to content

Commit 3fdb2f6

Browse files
committed
Ensure datetime index when epoch is specified
1 parent d36187d commit 3fdb2f6

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

harp/io.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,12 @@ def _fromraw(
132132
keep_type: bool = False,
133133
):
134134
if len(data) == 0:
135-
return pd.DataFrame(columns=columns, index=pd.Index([], dtype=np.float64, name="Time"))
135+
return pd.DataFrame(
136+
columns=columns,
137+
index=pd.DatetimeIndex([], name="Time")
138+
if epoch
139+
else pd.Index([], dtype=np.float64, name="Time"),
140+
)
136141

137142
if address is not None and address != data[2]:
138143
raise ValueError(f"expected address {address} but got {data[2]}")

0 commit comments

Comments
 (0)