You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Imagine DataFrames wanted to support push!(df::DataFrame, row) for arbitrary row as long as it's a valid Tables.jl row.
It'd be nice to enable DataFrames to implement this like:
push!(df::DataFrame, row) = Tables.isrow(row) ?#= do it =#:throw(ArgumentError("hey that's not a row!")
(could have Tables.isrow(::AbstractRow) = true defined by default)
This would let DataFrames (and other packages) support non-AbstractRow rows in a manner that is still "safe" for values that are indeed row-like but probably intended to be scalars in a tabular data setting, so better errors can be thrown (i.e. avoid throwing a weird getcolumn MethodError if push!(df, "hello") is called)
The text was updated successfully, but these errors were encountered:
I also happen to stumble into this issue and also think that it could be nice. I think that it would be nice if Table.isrow(row::DataFrameRow) = true would be defined. This could help in StatsBase.predict, because that method now throws an ArgumentError for DataFrameRows. Instead, people have to manually construct a new DataFrame (or other Tables.istable object) from the DataFrameRow which is not very performant nor easy to use.
Imagine DataFrames wanted to support
push!(df::DataFrame, row)
for arbitraryrow
as long as it's a valid Tables.jl row.It'd be nice to enable DataFrames to implement this like:
(could have
Tables.isrow(::AbstractRow) = true
defined by default)This would let DataFrames (and other packages) support non-
AbstractRow
rows in a manner that is still "safe" for values that are indeed row-like but probably intended to be scalars in a tabular data setting, so better errors can be thrown (i.e. avoid throwing a weirdgetcolumn
MethodError ifpush!(df, "hello")
is called)The text was updated successfully, but these errors were encountered: