diff --git a/src/abstractdataframe/iteration.jl b/src/abstractdataframe/iteration.jl index 7cc0dcb2a6..bc07b71dd3 100644 --- a/src/abstractdataframe/iteration.jl +++ b/src/abstractdataframe/iteration.jl @@ -456,8 +456,7 @@ function mapcols!(f::Union{Function, Type}, df::DataFrame) end for (i, col) in enumerate(vs) - fic = firstindex(col) - fic != 1 && _onebased_check_error(i, fic) + firstindex(col) != 1 && _onebased_check_error(i, col) end @assert length(vs) == ncol(df) diff --git a/src/dataframe/dataframe.jl b/src/dataframe/dataframe.jl index b219f4b568..6b19a51f83 100644 --- a/src/dataframe/dataframe.jl +++ b/src/dataframe/dataframe.jl @@ -209,8 +209,7 @@ struct DataFrame <: AbstractDataFrame end for (i, col) in enumerate(columns) - fic = firstindex(col) - fic != 1 && _onebased_check_error(i, fic) + firstindex(col) != 1 && _onebased_check_error(i, col) end new(convert(Vector{AbstractVector}, columns), colindex) @@ -392,10 +391,10 @@ _columns(df::DataFrame) = getfield(df, :columns) _onebased_check_error() = throw(ArgumentError("Currently DataFrames.jl supports only columns " * "that use 1-based indexing")) -_onebased_check_error(i, fic) = +_onebased_check_error(i, col) = throw(ArgumentError("Currently DataFrames.jl supports only " * "columns that use 1-based indexing, but " * - "column $i has starting index equal to $fic")) + "column $i has starting index equal to $(firstindex(col))")) # note: these type assertions are required to pass tests nrow(df::DataFrame) = ncol(df) > 0 ? length(_columns(df)[1])::Int : 0 @@ -418,8 +417,7 @@ function _check_consistency(df::DataFrame) cols, idx = _columns(df), index(df) for (i, col) in enumerate(cols) - fic = firstindex(col) - fic != 1 && _onebased_check_error(i, fic) + firstindex(col) != 1 && _onebased_check_error(i, col) end ncols = length(cols)