无法在Julia 1.0中安装“ DateTime”软件包?

时间:2019-02-25 11:14:20

标签: julia

无法在Julia 1.0中添加“ DateTime”包。如何对这个问题进行排序? 使用Pkg

julia> Pkg.add("DateTime")
ERROR: The following package names could not be resolved:
 * dateTime (not found in project, manifest or registry)
Please specify by known `name=uuid`.
Stacktrace:
 [1] pkgerror(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:120
 [2] #ensure_resolved#72(::Bool, ::Function, ::Pkg.Types.EnvCache, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:1010
 [3] #ensure_resolved at ./none:0 [inlined]
 [4] #add_or_develop#15(::Symbol, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:49
 [5] #add_or_develop at ./none:0 [inlined]
 [6] #add_or_develop#14 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:31 [inlined]
 [7] #add_or_develop at ./none:0 [inlined]
 [8] #add_or_develop#13 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:29 [inlined]
 [9] #add_or_develop at ./none:0 [inlined]
 [10] #add_or_develop#12(::Base.Iterators.Pairs{Symbol,Symbol,Tuple{Symbol},NamedTuple{(:mode,),Tuple{Symbol}}}, ::Function, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:28
 [11] #add_or_develop at ./none:0 [inlined]
 [12] #add#20 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:59 [inlined]
 [13] add(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:59
 [14] top-level scope at none:0

julia> 

1 个答案:

答案 0 :(得分:3)

DateTime.jl的文档显示为:

  

该项目现在已过时。从0.4-dev版本开始,日期和   时间功能已添加到Julia库。

您需要什么功能?通常,在处理日期时,请使用内置的Dates

using Dates

编辑

由于您在这里要求的示例是:

julia> using DataFrames

julia> d = DataFrame( col1 = ["2018-01-01","2018-02-10","2018-03-20"])
3×1 DataFrame
│ Row │ col1       │
│     │ String     │
├─────┼────────────┤
│ 1   │ 2018-01-01 │
│ 2   │ 2018-02-10 │
│ 3   │ 2018-03-20 │

julia> using Dates

julia> d.col1 = Date.(d.col1);

julia> d
3×1 DataFrame
│ Row │ col1       │
│     │ Date       │
├─────┼────────────┤
│ 1   │ 2018-01-01 │
│ 2   │ 2018-02-10 │
│ 3   │ 2018-03-20 │

请注意如何使用点运算符.对操作进行矢量化。