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 - Second Edition

Book Description

Become an efficient data science practitioner by understanding Python's key concepts

About This Book

  • Quickly get familiar with data science using Python 3.5
  • Save time (and effort) with all the essential tools explained
  • Create effective data science projects and avoid common pitfalls with the help of examples and hints dictated by experience

Who This Book Is For

If you are an aspiring data scientist and you have at least a working knowledge of data analysis and Python, this book will get you started in data science. Data analysts with experience of R or MATLAB will also find the book to be a comprehensive reference to enhance their data manipulation and machine learning skills.

What You Will Learn

  • Set up your data science toolbox using a Python scientific environment on Windows, Mac, and Linux
  • Get data ready for your data science project
  • Manipulate, fix, and explore data in order to solve data science problems
  • Set up an experimental pipeline to test your data science hypotheses
  • Choose the most effective and scalable learning algorithm for your data science tasks
  • Optimize your machine learning models to get the best performance
  • Explore and cluster graphs, taking advantage of interconnections and links in your data

In Detail

Fully expanded and upgraded, the second edition of Python Data Science Essentials takes you through all you need to know to suceed in data science using Python. Get modern insight into the core of Python data, including the latest versions of Jupyter notebooks, NumPy, pandas and scikit-learn. Look beyond the fundamentals with beautiful data visualizations with Seaborn and ggplot, web development with Bottle, and even the new frontiers of deep learning with Theano and TensorFlow.

Dive into building your essential Python 3.5 data science toolbox, using a single-source approach that will allow to to work with Python 2.7 as well. Get to grips fast with data munging and preprocessing, and all the techniques you need to load, analyse, and process your data. Finally, get a complete overview of 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.

Style and approach

The book is structured as a data science project. You will always benefit from clear code and simplified examples to help you understand the underlying mechanics and real-world datasets.

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 code file.

Table of Contents

  1. Python Data Science Essentials - Second Edition
    1. Python Data Science Essentials - Second Edition
    2. Credits
    3. About the Authors
    4. About the Reviewer
    5. www.PacktPub.com
      1. Why subscribe?
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    7. 1. First Steps
      1. Introducing data science and Python
      2. Installing Python
        1. Python 2 or Python 3?
        2. Step-by-step installation
        3. The installation of packages
        4. Package upgrades
        5. Scientific distributions
          1. Anaconda
          2. Leveraging conda to install packages
          3. Enthought Canopy
          4. PythonXY
          5. WinPython
        6. Explaining virtual environments
          1. conda for managing environments
        7. A glance at the essential packages
          1. NumPy
          2. SciPy
          3. pandas
          4. Scikit-learn
          5. Jupyter
          6. Matplotlib
          7. Statsmodels
          8. Beautiful Soup
          9. NetworkX
          10. NLTK
          11. Gensim
          12. PyPy
          13. XGBoost
          14. Theano
          15. Keras
      3. Introducing Jupyter
        1. Fast installation and first test usage
        2. Jupyter magic commands
        3. How Jupyter Notebooks can help data scientists
        4. Alternatives to Jupyter
      4. Datasets and code used in the book
        1. Scikit-learn toy datasets
          1. The MLdata.org public repository
          2. LIBSVM data examples
          3. Loading data directly from CSV or text files
          4. Scikit-learn sample generators
      5. Summary
    8. 2. 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. Data preprocessing
        6. Data selection
      3. Working with categorical and text 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 the 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's fast operations and computations
        1. Matrix operations
        2. Slicing and indexing with NumPy arrays
        3. Stacking NumPy arrays
      7. Summary
    9. 3. The Data Pipeline
      1. Introducing EDA
      2. Building new features
      3. Dimensionality reduction
        1. The covariance matrix
        2. Principal Component Analysis (PCA)
        3. PCA for big data – RandomizedPCA
        4. Latent Factor Analysis (LFA)
        5. Linear Discriminant Analysis (LDA)
        6. Latent Semantical Analysis (LSA)
        7. Independent Component Analysis (ICA)
        8. Kernel PCA
        9. T-SNE
        10. Restricted Boltzmann Machine (RBM)
      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
    10. 4. 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
      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. Approaching deep learning
      9. A peek at 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
      10. An overview of unsupervised learning
      11. Summary
    11. 5. Social Network Analysis
      1. Introduction to graph theory
      2. Graph algorithms
      3. Graph loading, dumping, and sampling
      4. Summary
    12. 6. Visualization, Insights, and Results
      1. Introducing the basics of matplotlib
        1. Curve plotting
        2. Using panels
        3. Scatterplots for relationships in data
        4. Histograms
        5. Bar graphs
        6. Image visualization
        7. Selected graphical examples with pandas
          1. Boxplots and histograms
        8. Scatterplots
        9. Parallel coordinates
      2. Wrapping up matplotlib's commands
        1. Introducing Seaborn
        2. Enhancing your EDA capabilities
      3. Interactive visualizations with Bokeh
      4. Advanced data-learning representations
        1. Learning curves
        2. Validation curves
        3. Feature importance for RandomForests
        4. GBT partial dependence plots
        5. Creating a prediction server for ML-AAS
      5. Summary
    13. 1. Strengthen Your Python Foundations
      1. Your learning list
        1. Lists
        2. Dictionaries
        3. Defining functions
        4. Classes, objects, and OOP
        5. Exceptions
        6. Iterators and generators
        7. Conditionals
        8. Comprehensions for lists and dictionaries
      2. Learn by watching, reading, and doing
        1. MOOCs
        2. PyCon and PyData
        3. Interactive Jupyter
        4. Don't be shy, take a real challenge