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

CartesianIndex error in Julia 1.11 #3412

Closed
drizk1 opened this issue Jan 6, 2024 · 4 comments · Fixed by #3413
Closed

CartesianIndex error in Julia 1.11 #3412

drizk1 opened this issue Jan 6, 2024 · 4 comments · Fixed by #3413
Labels
Milestone

Comments

@drizk1
Copy link
Contributor

drizk1 commented Jan 6, 2024

Hello, dataframes.jl is wonderful.

The TidierData.jl unnest_longer function is now causing an error on the 1.11 nightly run. which I would like to address

Is there different way to write to the line below to avoid the error and accommodate this behavior change for both 1.8 and 1.11?

Thank you

excerpt of code line causing problem and error:

    if !keep_empty
      df_copy = filter(row -> !any(ismissing, [row[col] for col in column_symbols]), df_copy) 
       ### this line above is where the error is originating.
    end


ERROR: MethodError: no method matching DataFrames.SubDataFrame(::DataFrame, ::CartesianIndex{1}, ::Colon)    
    Closest candidates are:
      DataFrames.SubDataFrame(::DataFrame, !Matched::Colon, ::Any)
       @ DataFrames ~/.julia/packages/DataFrames/58MUJ/src/subdataframe/subdataframe.jl:86
      DataFrames.SubDataFrame(::DataFrame, !Matched::AbstractVector{Bool}, ::Any)
       @ DataFrames ~/.julia/packages/DataFrames/58MUJ/src/subdataframe/subdataframe.jl:98
      DataFrames.SubDataFrame(::DataFrame, !Matched::AbstractVector{Int64}, ::Any)
       @ DataFrames ~/.julia/packages/DataFrames/58MUJ/src/subdataframe/subdataframe.jl:80

    
    Stacktrace:
      [1] copyto!
        @ ./broadcast.jl:0 [inlined]
      [2] copyto!
        @ Base.Broadcast ./broadcast.jl:924 [inlined]
      [3] copy
        @ Base.Broadcast ./broadcast.jl:896 [inlined]
      [4] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, DataFrames.var"#103#104"{TidierData.var"#77#81"{Vector{String}}}, Tuple{DataFrames.DataFrameRows{DataFrame}}})
        @ Base.Broadcast ./broadcast.jl:871
      [5] _filter_helper(f::Function, cols::DataFrames.DataFrameRows{DataFrame})
        @ DataFrames ~/.julia/packages/DataFrames/58MUJ/src/abstractdataframe/abstractdataframe.jl:1216
      [6] #filter#92
        @ DataFrames ~/.julia/packages/DataFrames/58MUJ/src/abstractdataframe/abstractdataframe.jl:1189 [inlined]
      [7] filter(f::Function, df::DataFrame)
        @ DataFrames ~/.julia/packages/DataFrames/58MUJ/src/abstractdataframe/abstractdataframe.jl:1188
      [8] unnest_longer(df::DataFrame, cols::Vector{Symbol}; indices_include::Nothing, keep_empty::Bool)
        @ TidierData ~/work/TidierData.jl/TidierData.jl/src/nests.jl:117
      [9] macro expansion
        @ ~/work/TidierData.jl/TidierData.jl/src/nests.jl:158 [inlined]
     [10] top-level scope
      @ none:3
@bkamins
Copy link
Member

bkamins commented Jan 6, 2024

Fixed in #3413

@bkamins bkamins added the bug label Jan 6, 2024
@bkamins bkamins added this to the 1.7 milestone Jan 6, 2024
@drizk1
Copy link
Contributor Author

drizk1 commented Jan 6, 2024

Incredible how fast that was. Thank you so much!

@drizk1 drizk1 closed this as completed Jan 6, 2024
@bkamins
Copy link
Member

bkamins commented Jan 6, 2024

For the time being, you can manually add the:

Base.getindex(itr::DataFrames.DataFrameRows, i::CartesianIndex{1}) = itr[i[1]]

line in your code to make things work on nightly.

@drizk1
Copy link
Contributor Author

drizk1 commented Jan 6, 2024

Thank you! I actually just reran the workflow w no changes, and it worked w the original code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants