O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Python Data Science Essentials - Third Edition

Book Description

Gain useful insights from your data using popular data science tools

Key Features

  • A one-stop guide to Python libraries such as pandas and NumPy
  • Comprehensive coverage of data science operations such as data cleaning and data manipulation
  • Choose scalable learning algorithms for your data science tasks

Book Description

Fully expanded and upgraded, the latest edition of Python Data Science Essentials will help you succeed in data science operations using the most common Python libraries. This book offers up-to-date insight into the core of Python, including the latest versions of the Jupyter Notebook, NumPy, pandas, and scikit-learn.

The book covers detailed examples and large hybrid datasets to help you grasp essential statistical techniques for data collection, data munging and analysis, visualization, and reporting activities. You will also gain an understanding of advanced data science topics such as machine learning algorithms, distributed computing, tuning predictive models, and natural language processing. Furthermore, You'll also be introduced to deep learning and gradient boosting solutions such as XGBoost, LightGBM, and CatBoost.

By the end of the book, you will have gained a complete overview of the principal machine learning algorithms, graph analysis techniques, and all the visualization and deployment instruments that make it easier to present your results to an audience of both data science experts and business users

What you will learn

  • Set up your data science toolbox on Windows, Mac, and Linux
  • Use the core machine learning methods offered by the scikit-learn library
  • Manipulate, fix, and explore data to solve data science problems
  • Learn advanced explorative and manipulative techniques to solve data operations
  • Optimize your machine learning models for optimized performance
  • Explore and cluster graphs, taking advantage of interconnections and links in your data

Who this book is for

If you're a data science entrant, data analyst, or data engineer, this book will help you get ready to tackle real-world data science problems without wasting any time. Basic knowledge of probability/statistics and Python coding experience will assist you in understanding the concepts covered in this book.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Python Data Science Essentials Third Edition
  3. Packt Upsell
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the authors
    2. About the reviewers
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. First Steps
    1. Introducing data science and Python
    2. Installing Python
      1. Python 2 or Python 3?
      2. Step-by-step installation
      3. Installing the necessary packages
      4. Package upgrades
      5. Scientific distributions
        1. Anaconda
        2. Leveraging conda to install packages
        3. Enthought Canopy
        4. WinPython
      6. Explaining virtual environments
        1. Conda for managing environments
      7. A glance at the essential packages
        1. NumPy
        2. SciPy
        3. pandas
        4. pandas-profiling
        5. Scikit-learn
        6. Jupyter
        7. JupyterLab
        8. Matplotlib
        9. Seaborn
        10. Statsmodels
        11. Beautiful Soup
        12. NetworkX
        13. NLTK
        14. Gensim
        15. PyPy
        16. XGBoost
        17. LightGBM
        18. CatBoost
        19. TensorFlow
        20. Keras
    3. Introducing Jupyter
      1. Fast installation and first test usage
      2. Jupyter magic commands
      3. Installing packages directly from Jupyter Notebooks
      4. Checking the new JupyterLab environment
      5. How Jupyter Notebooks can help data scientists
      6. Alternatives to Jupyter
    4. Datasets and code used in this book
      1. Scikit-learn toy datasets
        1. The MLdata.org and other public repositories for open source data
        2. LIBSVM data examples
        3. Loading data directly from CSV or text files
        4. Scikit-learn sample generators
    5. Summary
  7. Data Munging
    1. The data science process
    2. Data loading and preprocessing with pandas
      1. Fast and easy data loading
      2. Dealing with problematic data
      3. Dealing with big datasets
      4. Accessing other data formats
      5. Putting data together
      6. Data preprocessing
      7. Data selection
    3. Working with categorical and textual data
      1. A special type of data – text
      2. Scraping the web with Beautiful Soup
    4. Data processing with NumPy
      1. NumPy's n-dimensional array
      2. The basics of NumPy ndarray objects
    5. Creating NumPy arrays
      1. From lists to unidimensional arrays
      2. Controlling memory size
      3. Heterogeneous lists
      4. From lists to multidimensional arrays
      5. Resizing arrays
      6. Arrays derived from NumPy functions
      7. Getting an array directly from a file
      8. Extracting data from pandas
    6. NumPy fast operation and computations
      1. Matrix operations
      2. Slicing and indexing with NumPy arrays
      3. Stacking NumPy arrays
      4. Working with sparse arrays
    7. Summary
  8. The Data Pipeline
    1. Introducing EDA
    2. Building new features
    3. Dimensionality reduction
      1. The covariance matrix
      2. Principal component analysis
      3. PCA for big data – RandomizedPCA
      4. Latent factor analysis
      5. Linear discriminant analysis
      6. Latent semantical analysis
      7. Independent component analysis
      8. Kernel PCA
      9. T-SNE
      10. Restricted Boltzmann Machine
    4. The detection and treatment of outliers
      1. Univariate outlier detection
      2. EllipticEnvelope
      3. OneClassSVM
    5. Validation metrics
      1. Multilabel classification
      2. Binary classification
      3. Regression
    6. Testing and validating
    7. Cross-validation
      1. Using cross-validation iterators
      2. Sampling and bootstrapping
    8. Hyperparameter optimization
      1. Building custom scoring functions
      2. Reducing the grid search runtime
    9. Feature selection
      1. Selection based on feature variance
      2. Univariate selection
      3. Recursive elimination
      4. Stability and L1-based selection
    10. Wrapping everything in a pipeline
      1. Combining features together and chaining transformations
      2. Building custom transformation functions
    11. Summary
  9. Machine Learning
    1. Preparing tools and datasets
    2. Linear and logistic regression
    3. Naive Bayes
    4. K-Nearest Neighbors
    5. Nonlinear algorithms
      1. SVM for classification
      2. SVM for regression
      3. Tuning SVM
    6. Ensemble strategies
      1. Pasting by random samples
      2. Bagging with weak classifiers
      3. Random Subspaces and Random Patches
      4. Random Forests and Extra-Trees
      5. Estimating probabilities from an ensemble
      6. Sequences of models – AdaBoost
      7. Gradient tree boosting (GTB)
      8. XGBoost
      9. LightGBM
      10. CatBoost
    7. Dealing with big data
      1. Creating some big datasets as examples
      2. Scalability with volume
      3. Keeping up with velocity
      4. Dealing with variety
      5. An overview of Stochastic Gradient Descent (SGD)
    8. A peek into natural language processing (NLP)
      1. Word tokenization
      2. Stemming
      3. Word tagging
      4. Named entity recognition (NER)
      5. Stopwords
      6. A complete data science example – text classification
    9. An overview of unsupervised learning
      1. K-means
      2. DBSCAN – a density-based clustering technique
      3. Latent Dirichlet Allocation (LDA)
    10. Summary
  10. Visualization, Insights, and Results
    1. Introducing the basics of matplotlib
      1. Trying curve plotting
      2. Using panels for clearer representations
      3. Plotting scatterplots for relationships in data
      4. Histograms
      5. Bar graphs
      6. Image visualization
      7. Selected graphical examples with pandas
        1. Working with boxplots and histograms
        2. Plotting scatterplots
      8. Discovering patterns by parallel coordinates
    2. Wrapping up matplotlib's commands
      1. Introducing Seaborn
      2. Enhancing your EDA capabilities
    3. Advanced data learning representation
      1. Learning curves
      2. Validation curves
      3. Feature importance for RandomForests
      4. Gradient Boosting Trees partial dependence plotting
      5. Creating a prediction server with machine-learning-as-a-service
    4. Summary
  11. Social Network Analysis
    1. Introduction to graph theory
    2. Graph algorithms
      1. Types of node centrality
      2. Partitioning a network
    3. Graph loading, dumping, and sampling
    4. Summary
  12. Deep Learning Beyond the Basics
    1. Approaching deep learning
    2. Classifying images with CNN
    3. Using pre-trained models
    4. Working with temporal sequences
    5. Summary
  13. Spark for Big Data
    1. From a standalone machine to a bunch of nodes
      1. Making sense of why we need a distributed framework
      2. The Hadoop ecosystem
        1. Hadoop architecture
        2. Hadoop Distributed File System
        3. MapReduce
        4. Introducing Apache Spark
        5. PySpark
    2. Starting with PySpark
      1. Setting up your local Spark instance
      2. Experimenting with Resilient Distributed Datasets
    3. Sharing variables across cluster nodes
      1. Read-only broadcast variables
      2. Write-only accumulator variables
      3. Broadcast and accumulator variables together—an example
    4. Data preprocessing in Spark
      1. CSV files and Spark DataFrames
      2. Dealing with missing data
      3. Grouping and creating tables in-memory
      4. Writing the preprocessed DataFrame or RDD to disk
      5. Working with Spark DataFrames
    5. Machine learning with Spark
      1. Spark on the KDD99 dataset
      2. Reading the dataset
      3. Feature engineering
      4. Training a learner
      5. Evaluating a learner's performance
      6. The power of the machine learning pipeline
      7. Manual tuning
      8. Cross-validation
      9. Final cleanup
    6. Summary
  14. Strengthen Your Python Foundations
    1. Your learning list
      1. Lists
      2. Dictionaries
      3. Defining functions
      4. Classes, objects, and object-oriented programming
      5. Exceptions
      6. Iterators and generators
      7. Conditionals
      8. Comprehensions for lists and dictionaries
    2. Learn by watching, reading, and doing
      1. Massive open online courses (MOOCs)
      2. PyCon and PyData
      3. Interactive Jupyter
      4. Don't be shy, take a real challenge
  15. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think