I have some temporal experimental data in a DataFrame. I would like to round the timestamps to the nearest 10 seconds and then drop any rows that are not on an even minute. I have everything but the last step working below.
df = DataFrame()
df.Time = ["11:05:02", "11:05:23", "11:05:34", "11:05:42", "11:06:01"]
df.Data = rand(5)
df.Time = DateTime.(df.Time, DateFormat("H:M:S")) # I would rather just use Time type
df.Time = round.(df.Time, Second(10)) # but round is only defined for DateTime type
julia> df
5×2 DataFrame
Row │ Time Data
│ DateTime Float64
─────┼───────────────────────────────
1 │ 0001-01-01T11:05:00 0.987827
2 │ 0001-01-01T11:05:20 0.534373
3 │ 0001-01-01T11:05:30 0.571214
4 │ 0001-01-01T11:05:40 0.306041
5 │ 0001-01-01T11:06:00 0.209411
julia> filter!(:Time => time -> time % Minute(1) == 0, df)
ERROR: MethodError: no method matching rem(::DateTime, ::Minute)