Python Tutorial - Python Numpy Allclose

Publié le: 06 septembre 2018
sur la chaîne: 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


Sur cette page du site, vous pouvez voir la vidéo en ligne Python Tutorial - Python Numpy Allclose durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Python Marathon 06 septembre 2018, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 1,979 fois et il a aimé 23 téléspectateurs. Bon visionnage!