JuliaAcademy / DataScience

Data Science in Julia course for JuliaAcademy.com, taught by Huda Nassar
https://juliaacademy.com/p/julia-for-data-science
MIT License
488 stars 256 forks source link

insertcols in DataFrames has a breaking change #11

Closed RockHoward closed 3 years ago

RockHoward commented 4 years ago

The Clustering notebook includes 5 calls insertcols! that may no longer work due to a recent breaking change in DataFrames.jl.

While there are 5 instances of insertcols! in the Clustering notebook, I am specifically failing on the first one on line 296. This fails in the same way on both nteract and jupyter.

MethodError: no method matching insertcols!(::DataFrame, ::Int64, :String)

logankilpatrick commented 4 years ago

Hey @nassarhuda if you get a chance, can you take a look at this?

shaksham95 commented 3 years ago

I am also facing the same issue.

Code (first instance when insertcols is used): bucket_price = Int.(div.(houses_data[!, :median_house_value], 50000)); insertcols!(houses_data, 3, cprice=bucket_price)

Error:

ArgumentError: inserting columns using a keyword argument is not supported, pass a Pair as a positional argument instead

Stacktrace: [1] #insertcols!#182 at C:\Users\shaks.julia\packages\DataFrames\yqToF\src\dataframe\dataframe.jl:828 [inlined]

[3] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091

What is a possible workaround to this situation?

shaksham95 commented 3 years ago

No issues, got it resolved.

Replacing insertcols!(houses_data, 3, cprice=bucket_price) by insertcols!(houses_data, 3, :cprice => bucket_price) works.

logankilpatrick commented 3 years ago

Updated! Thanks for pointing this out.