日期不工作在ipython笔记本电脑,但在朱莉亚工作REPL
问题描述:
using Dates
dateReported = map((x) -> string(x), df[:DateReported])
df[:DateOccurred] = map((x) -> if match(r"^((19|20)\d\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])", x)!=nothing Date(x, DateFormat("yyyymmdd")) end, dateOccurred)
我想改变数据帧列的类型为从Int64日期。日期不工作在ipython笔记本电脑,但在朱莉亚工作REPL
最后一条语句返回一个错误
Date not defined
while loading In[18], in expression starting on line 1
in anonymous at In[18]:1
in map at /Users/ajkale/.julia/v0.3/DataArrays/src/datavector.jl:117
我想这在IPython中朱莉娅笔记本。这在REPL中工作正常。
答
日期不是0.3中的Julia标准库的一部分。从那时起,Julia 0.4和现在0.5已经将这个烘焙到标准库中。
听起来像你IPython中可能会使用不同版本的朱莉娅比你在REPL看到的。你可以在每个版本中运行'versioninfo()'来查看它们是否匹配? – quinnj 2014-11-24 17:13:56
两者对我来说都是一样的 – ajkl 2014-11-24 19:09:33