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
I want to know if 2 is within a subset of my dataframe.
df = DataFrame(a = [1,1], b=[2,2], c=[3,3])
# This doesn´t give the right answer, it returns false since it compares a dataframe to a number (I guess)
df[:,2:3] .== 2
# This works as I want to, returns an array of true/false
convert(Array, df[:,2:3]) .== 2
To me, the result of the first operation seems like something people might make mistakes with without noticing it. And the second solution is a bit cumbersome. Should this behaviour be changed?
The text was updated successfully, but these errors were encountered:
As I noted on Slack: Sounds like a bug. df[:,2:3] .== 2 should either throw an error or return a data frame of the same shape as the original but with Bool columns. Maybe it already behaves differently on Julia 0.7, but I get an error when trying to load DataFrames right now.
On Julia 0.7 is the same behavior. However, at least in my pipelines for StatsModels dataframes should always be converted to arrays in order to have Array like behavior. For a discussion on enabling Array behavior for AbstractDataFrames see #583.
I want to know if 2 is within a subset of my dataframe.
To me, the result of the first operation seems like something people might make mistakes with without noticing it. And the second solution is a bit cumbersome. Should this behaviour be changed?
The text was updated successfully, but these errors were encountered: