Skip to content

Commit

Permalink
df.to_csv(timestamps_path, columns=df_columns, index=True)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Lostanlen committed Dec 5, 2018
1 parent d9edbfd commit 48eb4d7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions birdvoxdetect/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ def process_file(
filepath, suffix + "timestamps.csv", output_dir=output_dir)
event_times = []
event_confidences = []
df_columns = ["Time (s)", "Confidence (%)"]
df = pd.DataFrame({
"Time (s)": event_times,
"Confidence (%)": event_confidences
})
df.to_csv(timestamps_path, index=True)
df.to_csv(timestamps_path, columns=df_columns, index=True)

# Create directory of output clips.
if export_clips:
Expand Down Expand Up @@ -180,7 +181,7 @@ def process_file(
"Time (s)": event_times,
"Confidence (%)": event_confidences
})
df.to_csv(timestamps_path, index=True)
df.to_csv(timestamps_path, columns=df_columns, index=True)

if export_clips:
for t in th_peak_timestamps:
Expand Down Expand Up @@ -251,7 +252,7 @@ def process_file(
"Time (s)": event_times,
"Confidence (%)": event_confidences
})
df.to_csv(timestamps_path, index=True)
df.to_csv(timestamps_path, columns=df_columns, index=True)

# Export clips.
if export_clips:
Expand Down Expand Up @@ -309,7 +310,7 @@ def process_file(
"Time (s)": event_times,
"Confidence (%)": event_confidences
})
df.to_csv(timestamps_path, index=True)
df.to_csv(timestamps_path, columns=df_columns, index=True)

# Export clips.
if export_clips:
Expand Down

0 comments on commit 48eb4d7

Please sign in to comment.