Skip to content

Commit

Permalink
Loosen constructor for a DataFrame (#1108)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyferris authored and nalimilan committed Jul 8, 2017
1 parent 851e7c4 commit 694ebfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/dataframe/dataframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ function DataFrame(; kwargs...)
return result
end

function DataFrame(columns::Vector{Any},
cnames::Vector{Symbol} = gennames(length(columns)))
return DataFrame(columns, Index(cnames))
function DataFrame(columns::AbstractVector,
cnames::AbstractVector{Symbol} = gennames(length(columns)))
return DataFrame(convert(Vector{Any}, columns), Index(convert(Vector{Symbol}, cnames)))
end


Expand Down
1 change: 1 addition & 0 deletions test/dataframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ module TestDataFrame
@test typeof(df[:,:a]) == NullableVector{Int}
@test typeof(df[:,:b]) == NullableVector{Char}

@test DataFrame(NullableArray[[1,2,3],[2.5,4.5,6.5]], [:A, :B]) == DataFrame(A = [1,2,3], B = [2.5,4.5,6.5])

# This assignment was missing before
df = DataFrame(Column = [:A])
Expand Down

0 comments on commit 694ebfe

Please sign in to comment.