Python Tutorial - Python Numpy Allclose

Veröffentlicht am: 06 September 2018
auf dem Kanal: Python Marathon
1,979
23

Descargar el Código: patreon.com/pythonmaraton

Join Patreon: patreon.com/pythonmaraton
^Downloadable code & more! This will show you how to use np.allclose, which can help coders test their output.

This is a Python anaconda tutorial for help with coding, programming, or computer science. These are short python videos dedicated to troubleshooting python problems and learning Python syntax. For more videos see Python Help playlist by Rylan Fowers.

✅Subscribe:    / @pythonmaraton  

📺Channel:    / @pythonmaraton  

▶️Watch Latest Python Content:    • Python String Slice and List Slice  

▶️Watch Latest Other Content:    • Video  





NP ALL CLOSE

Let me show you a great way to compare and test outputs and code

I like to use np.allclose

In Ipython we can see some of the parameters of this function

It takes in two things to compare, and you can set different tolerances. Also there is a parameter for how you want to deal with NAN or not a numbers

So for an example these will obviously return false because they are different

But let’s do something a bit harder. We will do 1 and a bunch of .9999s. This will return True since your computer cannot tell the difference, but we won’t get into details of why that is here.

So there you have it, that is how you use np.allclose in python

The creator studies Applied and Computational Mathematics at BYU (BYU ACME program)

#PythonMarathon #LearnPython #PythonTutorial


Auf dieser Seite können Sie das Online-Video Python Tutorial - Python Numpy Allclose mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Python Marathon 06 September 2018 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,979 Mal angesehen und es wurde von 23 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!