For instance if I create a dataframe as follows
X = rand(10, 10)
X = convert(DataFrame, X)
How do I show values > 0.5
Thanks in advance.
We should use the most practical tool to accomplish what we want. I don't think a DataFrame
is of much use here, so I suggest you convert it back to a numeric array. Of course, you're not planning to use this on an array of random numbers.
using DataFrames
X = rand(10, 10)
X = convert(DataFrame, X)
X = convert(Matrix, X)
ind = X .> 0.5
vals = X[ind]
ind
vals
#=
Main> ind
10×10 BitArray{2}:
false false true true true true false false true true
true false false true false false true true false false
true true false true false true true false false true
false true false true true false false true true false
true false true true true true false true true true
true false false true true true true true true true
false false true false false true true false false true
true true false true true false true true false false
false false false true true true false true false false
true true true false true true true false false false
Main> vals
57-element Array{Float64,1}:
0.52951
0.743512
0.576547
0.697369
0.951203
0.656204
⋮
0.803584
0.714883
0.730805
0.529729
0.845263
=#
You can check the position of the subset in the original array in ind
and the actual values in vals
DataFrame
as homogeneous object you can always convert it back to matrix by writingMatrix(df)
and work on it then. – Bogumił Kamiński