=Dates():Dates() includes extra ":day " in output


#1

Hi
I am new to Julia and tried the sample Jupyter notebooks on:


I could not get them to work as the code failed. As this is likely where new users go, its not a welcoming experience and has made me think of just using R!
I would like to use EconDatasets.jl which give a rave review for Julia:

The first code given here is wrong:
"Pkg.add(“EconDatasetsing EconDatasets” (sic)
The notebook is not given but the code is and I got the odd result that what seems to be a date range has ":day " stuck in the middle see below which fails in Juila. See several blocks down at:

dates = Date(1960,1,1):Date(2014,7,20)

[OUT] 1960-01-01:1 day:2014-07-20

Here are some of the other errors:
WARNING: requiring “Dates” in module “Main” did not define a corresponding module.

Please could you run this code and tell me what I need to do. I think that usch bugs are a turn-off and now wish I hadnt bothered.

Rupert


#2

Hi Rupert,

I’m not sure what the issue is with the "Pkg.add("EconDatasetsing EconDatasets" (sic) thing. The article has the code

Pkg.add("EconDatasets")
using EconDatasets

for me, and this works just fine. Is it possible that this was a typo in the article that has since been corrected?

As for the thing about dates, it’s not a bug - it’s just a slightly odd way of printing a range. In Julia the notation 0:2:10 means a range from 0 to 10 with a step size of 2. The thing you saw printed, 1960-01-01:1 day:2014-07-20, means a range of dates from 1 Jan 1960 to 20 July 2014 with a step size of 1 day. It’s not entirely obvious because of the space in 1 day. Maybe this would be better printed as 1960-01-01:(1 day):2014-07-20. I don’t really work with time series much so I haven’t really followed the development of the Dates code.

Let us know if you run into other issues. Unfortunately one of the frustrating things with taking up Julia at the moment is that the language is moving fast and so a lot of material out there, like those jupyter notebooks, is out of date. If you’d like some more resources, check http://julialang.org/learning/.

Best,
Scott


#3

The website doesn’t work for me either, but the problem appears to be CSS related, as it briefly appears correct, then changes as it renders.