I’m processing a CSV file where I have a couple of years of recordings, there are several readings per hour, and I’m summing them altogether to get a total per day.
I get the data into a dataframe ok.
julia> df
32047×6 DataFrame
Row │ Location date A mW/cm2 T degC RH %
│ String15 DateTime Float64? Int64? Float64? Int64?
1 │ Mezzaine NE 2022-08-08T11:45:00 229.8 0 25.3 47
I can get the vales of A for each day and sum these with
gdf = groupby(transform(df, :date => x->yearmonthday.(x)),:date_function)
A_totals = combine(gdf,:A => sum)
The problem is this put the date as a tuple into the new dataframe
julia> A_totals
'349×2 DataFrame
(2022, 8, 8) 2921.49
(2022, 8, 9) 5954.86`
I need to have that tuple as a DateTime type, I tried converting it by cturning it into a string, or using a DateFormat specifier, but neither worked.
julia> d
(2022, 8, 8)
julia> ds=string(d)
"(2022, 8, 8)"
dt=DateTime(ds)
ERROR: ArgumentError: Invalid DateTime string
julia> df
dateformat"(Y, M, D)"
julia> Date(d,df)
ERROR: MethodError: no method matching Int64(::Tuple{Int64, Int64, Int64})
Now I’m stuck.