We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I was surprised by this difference in results:
julia> using Dates, DataFrames julia> v = [Date(2010,1,1)] 1-element Vector{Date}: 2010-01-01 julia> DataFrame(v, :auto) 1×1 DataFrame Row │ x1 │ UTInstan… ─────┼───────────────────────────── 1 │ UTInstant{Day}(Day(733773)) julia> df[1,1] isa Date false julia> DataFrame("x" => v) 1×1 DataFrame Row │ x │ Date ─────┼──────────── 1 │ 2010-01-01 julia> df[1,1] isa Date true
So :auto does more than automatically generate column names? It slightly affects how Dates and DateTimes are stored? Or is this an unintentional bug?
:auto
Using Julia 1.11.3 and DataFrames 1.7.0.
The text was updated successfully, but these errors were encountered:
The issue is unreladed with :auto. First, what should have been done:
julia> DataFrame([v], :auto) 1×1 DataFrame Row │ x1 │ Date ─────┼──────────── 1 │ 2010-01-01
What you do overrides this behaviour:
julia> DataFrame(v) 1×1 DataFrame Row │ instant │ UTInstan… ─────┼───────────────────────────── 1 │ UTInstant{Day}(Day(733773))
(by adding extra auto-generation of column names).
This is a surprising behaviour (but documented). The constructor you are invoking is:
DataFrame(table; copycols::Union{Bool, Nothing}=nothing) DataFrame(table, names::AbstractVector; makeunique::Bool=false, copycols::Union{Bool, Nothing}=nothing)
as v (without being wrapped) is a Tables.jl table. Here is another similar example of this constructor in use (hopefully less surprising):
v
julia> DataFrame((a=[1, 2], b=[3, 4])) # Tables.jl table constructor 2×2 DataFrame Row │ a b │ Int64 Int64 ─────┼────────────── 1 │ 1 3 2 │ 2 4 julia> DataFrame([(a=1, b=0), (a=2, b=0)]) # Tables.jl table constructor 2×2 DataFrame Row │ a b │ Int64 Int64 ─────┼────────────── 1 │ 1 0 2 │ 2 0
Sorry, something went wrong.
No branches or pull requests
I was surprised by this difference in results:
So
:auto
does more than automatically generate column names? It slightly affects how Dates and DateTimes are stored? Or is this an unintentional bug?Using Julia 1.11.3 and DataFrames 1.7.0.
The text was updated successfully, but these errors were encountered: