Skip to content
New issue

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

Loosen constructor for a DataFrame #1108

Merged
merged 6 commits into from
Oct 18, 2016
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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([[1,2,3], [2.5,4.5,6.5]], [:A, :B]) = DataFrame(A = [1,2,3], B = [2.5,4.5,6.5])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is causing syntax errors:

FAILED: dataframe.jl
LoadError: syntax: "[[1,2,3],[2.5,4.5,6.5]]" is not a valid function argument name
 in macro expansion; at C:\Users\appveyor\.julia\v0.5\DataFrames\test\runtests.jl:43 [inlined]
 in anonymous at .\<missing>:?
 in include_from_node1 at .\loading.jl:488
 in process_options at .\client.jl:262
 in _start at .\client.jl:318
while loading C:\Users\appveyor\.julia\v0.5\DataFrames\test\dataframe.jl, in expression starting on line 188

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that is a really strange error message. The problem was I used = instead of ==

Sorry, like I said I only have a few moments here and there so I used the github web interface and relying on CI for testing.


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