我想把数据收集到朱莉娅。我有DataArrays.DataArray{String,1}名为"brokenDf“,它包含我想从dataframe和dataframe "df”中删除的串行id。
我得到的最接近的是“发现”
df[findin(df[:serial],brokenDf),:];
但是,我不知道在这之后如何翻转它,或者我们是否在朱莉娅中有NOT IN命令。因此,它的工作方式类似于findNOTin()。
如有任何建议,将不胜感激。
发布于 2017-04-26 10:43:59
下面应该做你想做的事:
using DataFrames
df = DataFrame(A = 1:6, B = ["M", "F", "F", "M", "N", "N"]);
# Rows where B .== "M"
f1 = find(df[:, 2] .== "M");
# Rows where B is not "M"
f2 = find(df[:, 2] .!= "M");
# Rows where B is not "M" and is not "F"
f3 = reduce(&, (df[:, 2] .!= "F", df[:, 2] .!= "M"));后者可以自动编写函数:
# Define function
function find_is_not(x, conditions)
    temp = sum(x .!= conditions, 2);
    res  = find(temp .== length(conditions));
    return res;
end
# Rows where B is not "M" and is not "F" (with find_is_not)
f4 = find_is_not(df[:, 2], ["M" "F"]);https://stackoverflow.com/questions/43631215
复制相似问题