Basically I want to make a histogram with a list of dates by using DateHistogram[]. However I have the data of the dates in nested list format, with elements like {2020,6,26}
, and although I know how to convert it to a date by using DateObject[{2020,6,26}]
I can not construct a list of dates by iteration. I am trying the following:
For[i = 0, i < 5, i++, Insert[egunak, DateObject[watchdates[[i]]], 1]]
where watchdates
is the nested list of {2020,6,26}
date elements and egunak
is the list I want to create with the dates (I have tried it to define it before).
I have also tried using Append
instead of Insert or by iterating with Do
, but didn't succeed. I am pretty new with the Wolfram language, sorry.
egunak = watchdates[[;;4]]
what you are looking for? $\endgroup$ – Edmund Jun 26 '20 at 22:31AppendTo
and compare it withAppend
. Also,Do
is better thanFor
because it's less error prone, but functional solutions likeMap
is the best of all in almost all situations. (Easier to read and has better performance.) $\endgroup$ – C. E. Jun 27 '20 at 8:43