Thank you. StatsBase works great for me.

Is there a good way to use number formatting with string interpolation? I 
ended up with something like

  println("a[$i] = ", @sprintf("%0.2f", a[i]))

It seems a bit clumsy.



On Thursday, February 20, 2014 4:45:21 AM UTC-8, Stefan Karpinski wrote:
>
> On Thu, Feb 20, 2014 at 1:36 AM, Wai Yip Tung 
> <[email protected]<javascript:>
> > wrote:
>
>> I am trying to port some code from Python to Julia. I was using a 
>> function numpy.random.choice, which accept a parameter to define 
>> probability of each individual entry. I wonder if there is a corresponding 
>> Julia function.
>>
>
> This ought to do the trick: 
> https://github.com/JuliaStats/StatsBase.jl#sampling-from-population.
>  
>
>> Another more basic question is how do we do number formatting like %0.2f 
>> ?
>>
>
> @printf("%0.2f", x)
>
>

Reply via email to