Ad

Thursday, April 26, 2018

Python Beyond the Basics

Python tricks for Data Science
  • Alphanumeric fancy word for char.lower() in "0123456789abcdefghijklmnopqrstuvwxyz". Fun fact, "6".lower() is still "6"
  • You can get the size of your heap queue aka priority queue by taking the len() of the heapq variable. Example: heap = [] hq.heappush(heap, 3) len(heap) is now 1.
  • import random random.random() returns a number between 0 and 1, want it bigger? multiply by an integer: random.random()*5 or 5*random.random()
  • Python science, data, linear algebra library landscape: numpy for vectors matrices high level math functions. SciPy math classes and functions useful for scientists. PyLab combines other libraries to provide MATLAB like interface.

No comments:

Post a Comment

Firebase Stripe Extension for payment debugging

 If your stripe webhook contains errors, Stripe will email you and inform you that requests to this end point has failed. In this case, we g...