# TKDE example in pyroot

**URL:** <https://root-forum.cern.ch/t/tkde-example-in-pyroot/45360>\
**Category:** Newbie\
**Created:** [June 11, 2021, 4:18pm UTC](https://root-forum.cern.ch/t/tkde-example-in-pyroot/45360 "2021-06-11T16:18:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dertexaner](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dertexaner/32/21605_2.png) [@dertexaner](https://root-forum.cern.ch/u/dertexaner)\
**Post date:** [June 11, 2021, 4:18pm UTC](https://root-forum.cern.ch/t/tkde-example-in-pyroot/45360/1 "2021-06-11T16:18:40Z")

</div>

Dear experts,

Could you point me to a snippet of TKDE use in pyroot?  
i.e. something like this [ROOT: tutorials/math/exampleTKDE.C File Reference](https://root.cern.ch/doc/master/exampleTKDE_8C.html)  
It’s not clear to me how the syntax would work in python for the constructor.

Thanks!

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [June 12, 2021, 8:57am UTC](https://root-forum.cern.ch/t/tkde-example-in-pyroot/45360/2 "2021-06-12T08:57:13Z")

</div>

Hi,

You can simply passes numpy array in the constructor. This works in Python for every C++ function taking an array (e.g. a double \*). Here is an example:

```auto
import ROOT
import numpy as np
x = np.random.normal(0,1,1000)
kde = ROOT.TKDE(1000, x, -3, 3,"",1.)
kde.Draw()

```

Lorenzo

---

<div class="post-metadata">

**Author:** ![dertexaner](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dertexaner/32/21605_2.png) [@dertexaner](https://root-forum.cern.ch/u/dertexaner)\
**Post date:** [June 13, 2021, 8:58am UTC](https://root-forum.cern.ch/t/tkde-example-in-pyroot/45360/3 "2021-06-13T08:58:27Z")

</div>

thanks!
