Programming with Python¶
Understanding what Python is and what it can be used for¶
What is programming?¶
A way to instruct a computer to perform tasks.
There are numerous programming languages, the choice of which can depend upon:
Availability within the given context
Suitability for performing a particular task
Knowledge of the programmer and other users
What is Python?¶
A high-level, popular, general-purpose programming language.
High-level: closer to human languages than machine code; very readable and relatively simple syntax
Popular: expected to become the most popular programming language (and already is by some metrics)
General-purpose: can be used for a wide variety of applications, such as games, web apps, and data analysis
Python for Data Analysis¶
Numerous open-source packages created and maintained by an active and growing Python community, to simplify programming for:
Data processing, analysis and visualisation
Data collection via APIs and web scraping
Machine learning and predictive modelling
Python for Data Analysis¶
Ability to handle larger volumes of data in a more robust, repeatable manner and with greater control than traditional spreadsheet applications such as Excel
Repeated operations are carried out more efficiently
Program logic is not hidden within the user interface
Where Python can be written and executed¶
via the command-line interface
Command Prompt on Windows or Terminal on Mac / Linux
text-based with limited formatting of outputs
via an IDE (Integrated Development Environment)
typically with features such as syntax highlighting and debugging tools
via an interactive notebook interface
typically with features such formatted display of code output and the ability to combine code with other media such as text and images
Jupyter notebook¶
A web-based, interactive computing notebook interface:
Create documents containing live code, visualisations and narrative text
Embed HTML, images and videos and use interactive widgets
Support for numerous programming languages (originally Julia, Python and R)
Notebook components¶
A kernel is a program which runs the code cells in a notebook
such as our installation of Python
A notebook is made of different types of cells:
Markdown cells can be used to add headings, notes and text lists
Code cells contain code compatible with the selected kernel
Additional functionality and numerous extensions available, such as:
Slideshow creation
Code formatting tools