Dear all,
I have a dataframe and I can use describe to have an initial hint of the data. But to have more control, I would like to find these values one column at the time.
So I can find the average of one column with mean(df[:column])
.
But if I do min(df[:column])
I get the error MethodError No method matching min
, but using statistics
is loaded.
And if I do describe(df[:column], stats = :min)
I get an argument error.
What is wrong?
Can I apply these basic statistics to selected columns of a dataframe? Can I find a median or quartile/percentiles?
Thank you
You want minimum(df[:column])
. Note that you can also do df.column
. The min
function is for returning the minimum of its arguments, for example min(0,1,2) == 0
. For describe
, the stats
keyword argument is deprecated. Use regular arguments instead, for example describe(df, :mean, :min)
.
Also note that you can view the documentation string for these functions directly in the REPL by typing e.g. ?describe
.
If you are not already aware of it, you may want to check out StatsBase.jl.
1 Like
Thank you. I use REPL but I did not know about minimum. I’ll have a look at StatsBase.
1 Like