2014-11-23 74 views
2
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中工作正常。

+1

聽起來像你IPython中可能會使用不同版本的朱莉婭比你在REPL看到的。你可以在每個版本中運行'versioninfo()'來查看它們是否匹配? – quinnj 2014-11-24 17:13:56

+0

兩者對我來說都是一樣的 – ajkl 2014-11-24 19:09:33

回答

相關問題