Python

  • Python is an object-oriented scripting language
  • Released publicly in 1991
  • Developed by Guido van Rossum of the National Research Institute for Mathematics and Computer Science in Amsterdam.
  • Has rapidly become one of the world’s most popular programming languages
  • Particularly popular for educational and scientific computing
  • Recently surpassed the programming language R as the most popular data-science programming language

Python (cont.)

  • Some reasons why Python is popular:
    • Open source, free and widely available with a massive open-source community
    • Easier to learn than many other languages, enabling novices and professional developers to get up to speed quickly
    • Easier to read than many other popular programming languages
    • Widely used in education.
    • Enhances developer productivity with extensive standard libraries and third-party open-source libraries
      • Programmers can write code faster and perform complex tasks with minimal code
    • Massive numbers of free open-source Python applications
    • Popular in web development (e.g., Django, Flask)
    • Supports popular procedural, functional-style and object-oriented programming
    • Build anything from simple scripts to complex apps with massive numbers of users, such as Dropbox, YouTube, Reddit, Instagram and Quora
    • Popular in artificial intelligence, which is enjoying explosive growth, in part because of its special relationship with data science
    • Widely used in the financial community
    • Extensive job market for Python programmers across many disciplines, especially in data-science-oriented positions, and Python jobs are among the highest paid of all programming jobs

Python Libraries

  • Existing libraries to help you avoid “reinventing the wheel”
  • Leverage your program-development efforts
  • Perform significant tasks with modest amounts of code

Python Standard Library

  • The Python Standard Library provides rich capabilities for
    • text/binary data processing, mathematics
    • functional-style programming
    • file/directory access
    • data persistence
    • data compression/archiving
    • cryptography
    • operating-system services
    • concurrent programming
    • interprocess communication
    • networking protocols
    • JSON/XML/other Internet data formats
    • multimedia
    • internationalization
    • GUI
    • debugging
    • profiling
    • and more

Some of the Python Standard Library modules we use in deitel's book

Library and its description
collections—Additional data structures beyond lists, tuples, dictionaries and sets.
csv—Processing comma-separated value files.
datetime, time—Date and time manipulations.
decimal—Fixed-point and floating-point arithmetic, including monetary calculations.
doctest—Simple unit testing via validation tests and expected results embedded in docstrings.
json—JavaScript Object Notation (JSON) processing for use with web services and NoSQL document databases.
math—Common math constants and operations.
os—Interacting with the operating system.
queue—First-in, first-out data structure.
random—Pseudorandom numbers.
re—Regular expressions for pattern matching.
sqlite3—SQLite relational database access.
statistics—Mathematical statistics functions like mean, median, mode and variance.
string—String processing.
sys—Command-line argument processing; standard input, standard output and standard error streams.
timeit—Performance analysis.

Data-Science Libraries

  • Enormous and rapidly growing community of open-source developers in many fields
  • One of the biggest reasons for Python’s popularity is the extraordinary range of open-source libraries developed by its open-source community
  • The following table lists various popular data-science libraries
Library and its use
Scientific Computing and Statistics
NumPy (Numerical Python)—Python does not have a built-in array data structure. It uses lists, which are convenient but relatively slow. NumPy provides the high-performance ndarray data structure to represent lists and matrices, and it also provides routines for processing such data structures.
SciPy (Scientific Python)—Built on NumPy, SciPy adds routines for scientific processing, such as integrals, differential equations, additional matrix processing and more. scipy.org controls SciPy and NumPy.
StatsModels—Provides support for estimations of statistical models, statistical tests and statistical data exploration.
Data Manipulation and Analysis
Pandas—An extremely popular library for data manipulations. Pandas makes abundant use of NumPy’s ndarray. Its two key data structures are Series (one dimensional) and DataFrames (two dimensional).
Visualization
Matplotlib—A highly customizable visualization and plotting library. Supported plots include regular, scatter, bar, contour, pie, quiver, grid, polar axis, 3D and text.
Seaborn—A higher-level visualization library built on Matplotlib. Seaborn adds a nicer look-and-feel, additional visualizations and enables you to create visualizations with less code.
Machine Learning, Deep Learning and Reinforcement Learning
scikit-learn—Top machine-learning library. Machine learning is a subset of AI. Deep learning is a subset of machine learning that focuses on neural networks.
Keras—One of the easiest to use deep-learning libraries. Keras runs on top of TensorFlow (Google), CNTK (Microsoft’s cognitive toolkit for deep learning) or Theano (Université de Montréal).
TensorFlow—From Google, this is the most widely used deep learning library. TensorFlow works with GPUs (graphics processing units) or Google’s custom TPUs (Tensor processing units) for performance. TensorFlow is important in AI and big data analytics—where processing demands are huge. You’ll use the version of Keras that’s built into TensorFlow.
OpenAI Gym—A library and environment for developing, testing and comparing reinforcement-learning algorithms.
Natural Language Processing (NLP)
NLTK (Natural Language Toolkit)—Used for natural language processing (NLP) tasks.
TextBlob—An object-oriented NLP text-processing library built on the NLTK and pattern NLP libraries. TextBlob simplifies many NLP tasks.
Gensim—Similar to NLTK. Commonly used to build an index for a collection of documents, then determine how similar another document is to each of those in the index.