Python for Programmers

Book description

The professional programmer’s Deitel® guide to Python® with introductory artificial intelligence case studies

Written for programmers with a background in another high-level language, Python for Programmers uses hands-on instruction to teach today’s most compelling, leading-edge computing technologies and programming in Python—one of the world’s most popular and fastest-growing languages. Please read the Table of Contents diagram inside the front cover and the Preface for more details.

In the context of 500+, real-world examples ranging from individual snippets to 40 large scripts and full implementation case studies, you’ll use the interactive IPython interpreter with code in Jupyter Notebooks to quickly master the latest Python coding idioms. After covering Python Chapters 1-5 and a few key parts of Chapters 6-7, you’ll be able to handle significant portions of the hands-on introductory AI case studies in Chapters 11-16, which are loaded with cool, powerful, contemporary examples. These include natural language processing, data mining Twitter® for sentiment analysis, cognitive computing with IBM® Watson™, supervised machine learning with classification and regression, unsupervised machine learning with clustering, computer vision through deep learning and convolutional neural networks, deep learning with recurrent neural networks, big data with Hadoop®, Spark™ and NoSQL databases, the Internet of Things and more. You’ll also work directly or indirectly with cloud-based services, including Twitter, Google Translate™, IBM Watson, Microsoft® Azure®, OpenMapQuest, PubNub and more.

Features

  • 500+ hands-on, real-world, live-code examples from snippets to case studies

  • IPython + code in Jupyter® Notebooks

  • Library-focused: Uses Python Standard Library and data science libraries to accomplish significant tasks with minimal code

  • Rich Python coverage: Control statements, functions, strings, files, JSON serialization, CSV, exceptions

  • Procedural, functional-style and object-oriented programming

  • Collections: Lists, tuples, dictionaries, sets, NumPy arrays, pandas Series & DataFrames

  • Static, dynamic and interactive visualizations

  • Data experiences with real-world datasets and data sources

  • Intro to Data Science sections: AI, basic stats, simulation, animation, random variables, data wrangling, regression

  • AI, big data and cloud data science case studies: NLP, data mining Twitter®, IBM® Watson™, machine learning, deep learning, computer vision, Hadoop®, Spark™, NoSQL, IoT

  • Open-source libraries: NumPy, pandas, Matplotlib, Seaborn, Folium, SciPy, NLTK, TextBlob, spaCy, Textatistic, Tweepy, scikit-learn®, Keras and more

Register your product for convenient access to downloads, updates, and/or corrections as they become available. See inside book for more information.

Table of contents

  1. Cover Page
  2. About This E-Book
  3. Half Title Page
  4. Series Page
  5. Title Page
  6. Copyright Page
  7. Dedication Page
  8. Contents
  9. Preface
    1. Jobs Requiring Data Science Skills
    2. Modular Architecture
    3. Key Features
    4. Chapter Dependencies
    5. Jupyter Notebooks
    6. Docker
    7. Special Feature: IBM Watson Analytics and Cognitive Computing
    8. Teaching Approach
    9. Software Used in the Book
    10. Python Documentation
    11. Getting Your Questions Answered
    12. Getting Jupyter Help
    13. Supplements
    14. Keeping in Touch with the Authors
    15. Acknowledgments
    16. About the Authors
    17. About Deitel® & Associates, Inc.
  10. Before You Begin
    1. Font and Naming Conventions
    2. Getting the Code Examples
    3. Structure of the examples Folder
    4. Installing Anaconda
    5. Updating Anaconda
    6. Package Managers
    7. Installing the Prospector Static Code Analysis Tool
    8. Installing jupyter-matplotlib
    9. Installing the Other Packages
    10. Get a Twitter Developer Account
    11. Internet Connection Required in Some Chapters
    12. Slight Differences in Program Outputs
    13. Getting Your Questions Answered
  11. 1. Introduction to Computers and Python
    1. 1.1 Introduction
    2. 1.2 A Quick Review of Object Technology Basics
    3. 1.3 Python
    4. 1.4 It’ s the Libraries!
    5. 1.5 Test-Drives: Using IPython and Jupyter Notebooks
    6. 1.6 The Cloud and the Internet of Things
    7. 1.7 How Big Is Big Data?
    8. 1.8 Case Study—A Big-Data Mobile Application
    9. 1.9 Intro to Data Science: Artificial Intelligence—at the Intersection of CS and Data Science
    10. 1.10 Wrap-Up
  12. 2. Introduction to Python Programming
    1. 2.1 Introduction
    2. 2.2 Variables and Assignment Statements
    3. 2.3 Arithmetic
    4. 2.4 Function print and an Intro to Single- and Double-Quoted Strings
    5. 2.5 Triple-Quoted Strings
    6. 2.6 Getting Input from the User
    7. 2.7 Decision Making: The if Statement and Comparison Operators
    8. 2.8 Objects and Dynamic Typing
    9. 2.9 Intro to Data Science: Basic Descriptive Statistics
    10. 2.10 Wrap-Up
  13. 3. Control Statements
    1. 3.1 Introduction
    2. 3.2 Control Statements
    3. 3.3 if Statement
    4. 3.4 if else and if
    5. 3.5 while Statement
    6. 3.6 for Statement
    7. 3.7 Augmented Assignments
    8. 3.8 Sequence-Controlled Iteration; Formatted Strings
    9. 3.9 Sentinel-Controlled Iteration
    10. 3.10 Built-In Function range: A Deeper Look
    11. 3.11 Using Type Decimal for Monetary Amounts
    12. 3.12 break and continue Statements
    13. 3.13 Boolean Operators and, or and not
    14. 3.14 Intro to Data Science: Measures of Central Tendency—Mean, Median and Mode
    15. 3.15 Wrap-Up
  14. 4. Functions
    1. 4.1 Introduction
    2. 4.2 Defining Functions
    3. 4.3 Functions with Multiple Parameters
    4. 4.4 Random-Number Generation
    5. 4.5 Case Study: A Game of Chance
    6. 4.6 Python Standard Library
    7. 4.7 math Module Functions
    8. 4.8 Using IPython Tab Completion for Discovery
    9. 4.9 Default Parameter Values
    10. 4.10 Keyword Arguments
    11. 4.11 Arbitrary Argument Lists
    12. 4.12 Methods: Functions That Belong to Objects
    13. 4.13 Scope Rules
    14. 4.14 import: A Deeper Look
    15. 4.15 Passing Arguments to Functions: A Deeper Look
    16. 4.16 Recursion
    17. 4.17 Functional-Style Programming
    18. 4.18 Intro to Data Science: Measures of Dispersion
    19. 4.19 Wrap-Up
  15. 5. Sequences: Lists and Tuples
    1. 5.1 Introduction
    2. 5.2 Lists
    3. 5.3 Tuples
    4. 5.4 Unpacking Sequences
    5. 5.5 Sequence Slicing
    6. 5.6 del Statement
    7. 5.7 Passing Lists to Functions
    8. 5.8 Sorting Lists
    9. 5.9 Searching Sequences
    10. 5.10 Other List Methods
    11. 5.11 Simulating Stacks with Lists
    12. 5.12 List Comprehensions
    13. 5.13 Generator Expressions
    14. 5.14 Filter, Map and Reduce
    15. 5.15 Other Sequence Processing Functions
    16. 5.16 Two-Dimensional Lists
    17. 5.17 Intro to Data Science: Simulation and Static Visualizations
    18. 5.18 Wrap-Up
  16. 6. Dictionaries and Sets
    1. 6.1 Introduction
    2. 6.2 Dictionaries
    3. 6.3 Sets
    4. 6.4 Intro to Data Science: Dynamic Visualizations
    5. 6.5 Wrap-Up
  17. 7. Array-Oriented Programming with NumPy
    1. 7.1 Introduction
    2. 7.2 Creating arrays from Existing Data
    3. 7.3 array Attributes
    4. 7.4 Filling arrays with Specific Values
    5. 7.5 Creating arrays from Ranges
    6. 7.6 List vs. array Performance: Introducing %timeit
    7. 7.7 array Operators
    8. 7.8 NumPy Calculation Methods
    9. 7.9 Universal Functions
    10. 7.10 Indexing and Slicing
    11. 7.11 Views: Shallow Copies
    12. 7.12 Deep Copies
    13. 7.13 Reshaping and Transposing
    14. 7.14 Intro to Data Science: pandas Series and DataFrames
    15. 7.15 Wrap-Up
  18. 8. Strings: A Deeper Look
    1. 8.1 Introduction
    2. 8.2 Formatting Strings
    3. 8.3 Concatenating and Repeating Strings
    4. 8.4 Stripping Whitespace from Strings
    5. 8.5 Changing Character Case
    6. 8.6 Comparison Operators for Strings
    7. 8.7 Searching for Substrings
    8. 8.8 Replacing Substrings
    9. 8.9 Splitting and Joining Strings
    10. 8.10 Characters and Character-Testing Methods
    11. 8.11 Raw Strings
    12. 8.12 Introduction to Regular Expressions
    13. 8.13 Intro to Data Science: Pandas, Regular Expressions and Data Munging
    14. 8.14 Wrap-Up
  19. 9. Files and Exceptions
    1. 9.1 Introduction
    2. 9.2 Files
    3. 9.3 Text-File Processing
    4. 9.4 Updating Text Files
    5. 9.5 Serialization with JSON
    6. 9.6 Focus on Security: pickle Serialization and Deserialization
    7. 9.7 Additional Notes Regarding Files
    8. 9.8 Handling Exceptions
    9. 9.9 finally Clause
    10. 9.10 Explicitly Raising an Exception
    11. 9.11 (Optional) Stack Unwinding and Tracebacks
    12. 9.12 Intro to Data Science: Working with CSV Files
    13. 9.13 Wrap-Up
  20. 10. Object-Oriented Programming
    1. 10.1 Introduction
    2. 10.2 Custom Class Account
    3. 10.3 Controlling Access to Attributes
    4. 10.4 Properties for Data Access
    5. 10.5 Simulating “Private” Attributes
    6. 10.6 Case Study: Card Shuffling and Dealing Simulation
    7. 10.7 Inheritance: Base Classes and Subclasses
    8. 10.8 Building an Inheritance Hierarchy; Introducing Polymorphism
    9. 10.9 Duck Typing and Polymorphism
    10. 10.10 Operator Overloading
    11. 10.11 Exception Class Hierarchy and Custom Exceptions
    12. 10.12 Named Tuples
    13. 10.13 A Brief Intro to Python 3.7’s New Data Classes
    14. 10.14 Unit Testing with Docstrings and doctest
    15. 10.15 Namespaces and Scopes
    16. 10.16 Intro to Data Science: Time Series and Simple Linear Regression
    17. 10.17 Wrap-Up
  21. 11. Natural Language Processing (NLP)
    1. 11.1 Introduction
    2. 11.2 TextBlob1
    3. 11.3 Visualizing Word Frequencies with Bar Charts and Word Clouds
    4. 11.4 Readability Assessment with Textatistic
    5. 11.5 Named Entity Recognition with spaCy
    6. 11.6 Similarity Detection with spaCy
    7. 11.7 Other NLP Libraries and Tools
    8. 11.8 Machine Learning and Deep Learning Natural Language Applications
    9. 11.9 Natural Language Datasets
    10. 11.10 Wrap-Up
  22. 12. Data Mining Twitter
    1. 12.1 Introduction
    2. 12.2 Overview of the Twitter APIs
    3. 12.3 Creating a Twitter Developer Account
    4. 12.4 Getting Twitter Credentials—Creating an App
    5. 12.5 What’s in a Twitter API Response?
    6. 12.6 Installing Tweepy, geopy, folium and deep-translator
    7. 12.7 Authenticating with Twitter Via Tweepy to Access Twitter v2 APIs
    8. 12.8 Getting Information About a Twitter Account
    9. 12.9 Intro to Tweepy Paginators: Getting More Than One Page of Results
    10. 12.10 Searching Recent Tweets; Intro to Twitter v2 API Search Operators
    11. 12.11 Spotting Trending Topics
    12. 12.12 Cleaning/Preprocessing Tweets for Analysis
    13. 12.13 Twitter Streaming API
    14. 12.14 Tweet Sentiment Analysis
    15. 12.15 Geocoding and Mapping
    16. 12.16 Storing Tweets
    17. 12.17 Twitter and Time Series
    18. 12.18 Wrap-Up
  23. 13. IBM Watson and Cognitive Computing
    1. 13.1 Introduction: IBM Watson and Cognitive Computing
    2. 13.2 IBM Cloud Account and Cloud Console
    3. 13.3 Watson Services
    4. 13.4 Additional Services and Tools
    5. 13.5 Watson Developer Cloud Python SDK
    6. 13.6 Case Study: Traveler’s Companion Translation App
    7. 13.7 Watson Resources
    8. 13.8 Wrap-Up
  24. 14. Machine Learning: Classification, Regression and Clustering
    1. 14.1 Introduction to Machine Learning
    2. 14.2 Case Study: Classification with k-Nearest Neighbors and the Digits Dataset, Part 1
    3. 14.3 Case Study: Classification with k-Nearest Neighbors and the Digits Dataset, Part 2
    4. 14.4 Case Study: Time Series and Simple Linear Regression
    5. 14.5 Case Study: Multiple Linear Regression with the California Housing Dataset
    6. 14.6 Case Study: Unsupervised Machine Learning, Part 1—Dimensionality Reduction
    7. 14.7 Case Study: Unsupervised Machine Learning, Part 2—k-Means Clustering
    8. 14.8 Wrap-Up
  25. 15. Deep Learning
    1. 15.1 Introduction
    2. 15.2 Keras Built-In Datasets
    3. 15.3 Custom Anaconda Environments
    4. 15.4 Neural Networks
    5. 15.5 Tensors
    6. 15.6 Convolutional Neural Networks for Vision; Multi-Classification with the MNIST Dataset
    7. 15.7 Visualizing Neural Network Training with TensorBoard
    8. 15.8 ConvnetJS: Browser-Based Deep-Learning Training and Visualization
    9. 15.9 Recurrent Neural Networks for Sequences; Sentiment Analysis with the IMDb Dataset
    10. 15.10 Tuning Deep Learning Models
    11. 15.11 Convnet Models Pretrained on ImageNet
    12. 15.12 Wrap-Up
  26. 16. Big Data: Hadoop, Spark, NoSQL and IoT
    1. 16.1 Introduction
    2. 16.2 Relational Databases and Structured Query Language (SQL)
    3. 16.3 NoSQL and NewSQL Big-Data Databases: A Brief Tour
    4. 16.4 Case Study: A MongoDB JSON Document Database
    5. 16.5 Hadoop
    6. 16.6 Spark
    7. 16.7 Spark Streaming: Counting Twitter Hashtags Using the pyspark-notebook Docker Stack
    8. 16.8 Internet of Things and Dashboards
    9. 16.9 Wrap-Up
  27. Index
  28. Code Snippets

Product information

  • Title: Python for Programmers
  • Author(s): Paul Deitel, Harvey Deitel
  • Release date: March 2019
  • Publisher(s): Pearson
  • ISBN: 9780135231364