You could say test[:start_date] = [datetime(value...) for value in zip(test[:Year], test[:Month], test[:DayofMonth])]
Or I think the following is what you were originally after test[:start_date] = [datetime(year,month,day) for (year,month,day) in zip(test[:Year], test[:Month], test[:DayofMonth])] Because of this issue: https://github.com/JuliaLang/julia/issues/6484 On Tue, Jul 1, 2014 at 9:44 PM, Randy Zwitch <[email protected]> wrote: > Sorry, not following...try value how? > > > On Tuesday, July 1, 2014 9:40:46 PM UTC-4, Isaiah wrote: > >> Try "value..." >> >> >> On Tue, Jul 1, 2014 at 9:37 PM, Randy Zwitch <[email protected]> >> wrote: >> >>> I have a data frame where the year, month, day, hour, etc. are in >>> different columns. I want to use Datetime.jl to make timestamps, then do >>> some processing. >>> >>> I tried to attack the problem like the following (which is to say, >>> Python-style), but it didn't work: >>> >>> test[:start_date] = [datetime(year,month,day) for year,month,day in >>> zip(test[:Year], test[:Month], test[:DayofMonth])] >>> >>> The working solution: >>> >>> test[:start_date] = [datetime(value[1],value[2],value[3]) for value in >>> zip(test[:Year], test[:Month], test[:DayofMonth])] >>> >>> I was somewhat surprised that I had to reference the fields in the tuple >>> by position, when syntax like a,b,c = (1,2,3) works elsewhere. Is there >>> something I'm missing/forgetting? Is there a better way to use multiple >>> columns from a data frame in a function to return a new column in the data >>> frame? >>> >> >>
