{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaData/DataFrames.jl/issues/1573","repository_url":"https://api.github.com/repos/JuliaData/DataFrames.jl","labels_url":"https://api.github.com/repos/JuliaData/DataFrames.jl/issues/1573/labels{/name}","comments_url":"https://api.github.com/repos/JuliaData/DataFrames.jl/issues/1573/comments","events_url":"https://api.github.com/repos/JuliaData/DataFrames.jl/issues/1573/events","html_url":"https://github.com/JuliaData/DataFrames.jl/issues/1573","id":371661820,"node_id":"MDU6SXNzdWUzNzE2NjE4MjA=","number":1573,"title":"Support for construction from a named tuple?","user":{"login":"jlperla","id":13106721,"node_id":"MDQ6VXNlcjEzMTA2NzIx","avatar_url":"https://avatars2.githubusercontent.com/u/13106721?v=4","gravatar_id":"","url":"https://api.github.com/users/jlperla","html_url":"https://github.com/jlperla","followers_url":"https://api.github.com/users/jlperla/followers","following_url":"https://api.github.com/users/jlperla/following{/other_user}","gists_url":"https://api.github.com/users/jlperla/gists{/gist_id}","starred_url":"https://api.github.com/users/jlperla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlperla/subscriptions","organizations_url":"https://api.github.com/users/jlperla/orgs","repos_url":"https://api.github.com/users/jlperla/repos","events_url":"https://api.github.com/users/jlperla/events{/privacy}","received_events_url":"https://api.github.com/users/jlperla/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-10-18T18:47:15Z","updated_at":"2018-10-19T03:08:18Z","closed_at":null,"author_association":"NONE","body":"I think this is related to #1569 but gives a very specific suggestion.\r\n\r\nExisting DataFrames seem to play very well with named tuples.  FOr example,\r\n```julia\r\njulia> df = DataFrame(a = Float64[], b = Int64[])\r\n0×2 DataFrame\r\n\r\njulia> push!(df, (a = 4.0, b = 2))\r\n1×2 DataFrame\r\n│ Row │ a       │ b     │\r\n│     │ Float64 │ Int64 │\r\n├─────┼─────────┼───────┤\r\n│ 1   │ 4.0     │ 2     │\r\n```\r\nWhat is irritating is that you cannot create the DataFrame directly from the named tuple, and instead need to specify types yourself.\r\n\r\nThere is a workaround with splatting, which can rely entirely on inference!\r\n```julia\r\njulia> t = (a = 4.0, b = 2)\r\n(a = 4.0, b = 2)\r\n\r\njulia> df = DataFrame(;t...)\r\n1×2 DataFrame\r\n│ Row │ a       │ b     │\r\n│     │ Float64 │ Int64 │\r\n├─────┼─────────┼───────┤\r\n│ 1   │ 4.0     │ 2     │\r\n```\r\nSo my question is: (1) is there any real flaw in the splatting interface\r\nand (2) would you be interested in a PR that makes this more explicit.  That is,  it would add in a constructor for named tuples and support \r\n```\r\njulia> t = (a = 4.0, b = 2)\r\n(a = 4.0, b = 2)\r\n\r\njulia> df = DataFrame(t) # not valid, but could be\r\n1×2 DataFrame\r\n│ Row │ a       │ b     │\r\n│     │ Float64 │ Int64 │\r\n├─────┼─────────┼───────┤\r\n│ 1   │ 4.0     │ 2     │\r\n```"},"comment":{"url":"https://api.github.com/repos/JuliaData/DataFrames.jl/issues/comments/431230962","html_url":"https://github.com/JuliaData/DataFrames.jl/issues/1573#issuecomment-431230962","issue_url":"https://api.github.com/repos/JuliaData/DataFrames.jl/issues/1573","id":431230962,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTIzMDk2Mg==","user":{"login":"quinnj","id":2896623,"node_id":"MDQ6VXNlcjI4OTY2MjM=","avatar_url":"https://avatars3.githubusercontent.com/u/2896623?v=4","gravatar_id":"","url":"https://api.github.com/users/quinnj","html_url":"https://github.com/quinnj","followers_url":"https://api.github.com/users/quinnj/followers","following_url":"https://api.github.com/users/quinnj/following{/other_user}","gists_url":"https://api.github.com/users/quinnj/gists{/gist_id}","starred_url":"https://api.github.com/users/quinnj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quinnj/subscriptions","organizations_url":"https://api.github.com/users/quinnj/orgs","repos_url":"https://api.github.com/users/quinnj/repos","events_url":"https://api.github.com/users/quinnj/events{/privacy}","received_events_url":"https://api.github.com/users/quinnj/received_events","type":"User","site_admin":false},"created_at":"2018-10-19T03:08:18Z","updated_at":"2018-10-19T03:08:18Z","author_association":"MEMBER","body":"That sounds good to me."}}
{"actor":{"display_login":"quinnj"}}