Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Jupyter for Data Science

You're reading from  Jupyter for Data Science

Product type Book
Published in Oct 2017
Publisher Packt
ISBN-13 9781785880070
Pages 242 pages
Edition 1st Edition
Languages
Author (1):
Dan Toomey Dan Toomey
Profile icon Dan Toomey

Table of Contents (17) Chapters

Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
1. Jupyter and Data Science 2. Working with Analytical Data on Jupyter 3. Data Visualization and Prediction 4. Data Mining and SQL Queries 5. R with Jupyter 6. Data Wrangling 7. Jupyter Dashboards 8. Statistical Modeling 9. Machine Learning Using Jupyter 10. Optimizing Jupyter Notebooks

Optimizing your script


There are optimizations that you can make to have your notebook scripts run more efficiently. The optimizations are script language dependent. We have covered using Python and R scripts in our notebooks and will cover optimizations that can be made for those two languages.

Jupyter does support additional languages, such as Scala and Spark. The other languages have their own optimization tools and strategies.

Optimizing your Python scripts

Performance tuning your Python scripts can be done using several tools:

  • timeit
  • Python regular expressions
  • String handling
  • Loop optimizations
  • hotshot profiling

Determining how long a script takes

The timeit function in Python takes a line of code and determines how long it takes to execute. You can also repeatedly execute the same script to see if there are start-up issues that need to be addressed.

timeit is used in this manner:

import timeitt = timeit.Timer("myfunction('Hello World')", "import myfunction")   t.timeit()              3.32132323232...
lock icon The rest of the chapter is locked
arrow left Previous Chapter
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}