Skip to content

Commit

Permalink
Fix push!(df, a, b, ...) (#1398)
Browse files Browse the repository at this point in the history
  • Loading branch information
cstjean authored and ararslan committed Apr 19, 2018
1 parent 0557c0e commit 3b762a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/dataframe/dataframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,7 @@ function Base.push!(df::DataFrame, dict::AbstractDict)
end
i += 1
end
df
end

# array and tuple like collections
Expand All @@ -1034,4 +1035,5 @@ function Base.push!(df::DataFrame, iterable::Any)
end
i += 1
end
df
end
8 changes: 8 additions & 0 deletions test/dataframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,14 @@ module TestDataFrame
dfb=DataFrame( first=["1","2","3"], second=["apple","orange","pear"] )
@test_throws ArgumentError push!(dfb, Dict(:first=>"chicken", :second=>1))
@test df0 == dfb

df = DataFrame(x=1)
push!(df, Dict(:x=>2), Dict(:x=>3))
@test df[:x] == [1,2,3]

df = DataFrame(x=1, y=2)
push!(df, [3, 4], [5, 6])
@test df[:x] == [1, 3, 5] && df[:y] == [2, 4, 6]
end

# delete!
Expand Down

0 comments on commit 3b762a2

Please sign in to comment.