# Problem with Listing 1.10 on Statistics With Julia Book

**URL:** <https://discourse.julialang.org/t/problem-with-listing-1-10-on-statistics-with-julia-book/27009>\
**Category:** New to Julia\
**Created:** [July 31, 2019, 12:08am UTC](https://discourse.julialang.org/t/problem-with-listing-1-10-on-statistics-with-julia-book/27009 "2019-07-31T00:08:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jar](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@jar](https://discourse.julialang.org/u/jar)\
**Post date:** [July 31, 2019, 12:08am UTC](https://discourse.julialang.org/t/problem-with-listing-1-10-on-statistics-with-julia-book/27009/1 "2019-07-31T00:08:30Z")

</div>

Hello folks.

I’m working with Hayden Klok and Yoni Nazarathy’s book “Statistics With Julia” and the Listing 1.10 dont work.  
the error is:  
Warning: ‘getindex(o::PyObject, s::Symbol)’ is deprecated in favor of dot overloading (‘getproperty’) so elements should now be accessed as e.g. ‘o.s’ instead of ‘o[:s]’.  
• caller - top-level scope at none:0  
Core none:0

I’ve tried several ways to solve, but I haven’t been successful. How do you solve this?

the code:

using PyPlot  
function hailLength(x,Int64)  
n=0  
while x != 1  
if x % 2 == 0  
x = Int(x/2)  
else  
x = 3x +1  
end  
n += 1  
end  
return n  
end  
lengths = [hailLength(x0) for x0 in 2:10^7]  
plt[:hist](lengths, 1000, density=“true”)  
xlabel(“Length”)  
ylabel(“Frequency”);

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [July 31, 2019, 12:28am UTC](https://discourse.julialang.org/t/problem-with-listing-1-10-on-statistics-with-julia-book/27009/2 "2019-07-31T00:28:04Z")

</div>

> elements should now be accessed as e.g. ‘o.s’ instead of ‘o[:s]’.

so use

```julia
plt.hist(lengths, 1000, density="true")

```

---

<div class="post-metadata">

**Author:** ![jar](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@jar](https://discourse.julialang.org/u/jar)\
**Post date:** [August 1, 2019, 6:13am UTC](https://discourse.julialang.org/t/problem-with-listing-1-10-on-statistics-with-julia-book/27009/3 "2019-08-01T06:13:39Z")

</div>

YEEEAAAH, thaks, I was looking at line 3 haha

> **[pyplot en Julia](https://deoxyt2.livejournal.com/179774.html)**
>
> Por estos das estuve pegado en un roblema de plot en Julialang utiizando la librera pyplot de python, anteriormente trabaj con otra librera de ploting, pero ahora estoy leyendo el libro Statistics With Julia \[DRAFT\] de Hayden Klok, Yoni Nazarathy ....

---

<div class="post-metadata">

**Author:** ![yoninazarathy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yoninazarathy/32/10086_2.png) [@yoninazarathy](https://discourse.julialang.org/u/yoninazarathy)\
**Post date:** [August 1, 2019, 11:25am UTC](https://discourse.julialang.org/t/problem-with-listing-1-10-on-statistics-with-julia-book/27009/4 "2019-08-01T11:25:26Z")

</div>

Hi, hope you are enjoying - feel free to contact us with direct feedback. We are just converting the code (of the whole book draft) from PyPlot.jl to Plots.jl. The updated draft version with Plots.jl code will be out at the end of the month.
