Skip to Main Content

Python for Basic Data Analysis

Start your data science journey with Python. Learn practical Python programming skills for basic data manipulation and analysis.

Getting Started

Welcome to Python Essentials for Data Analysis

This section will cover the basic syntax, data types, operators and statements that will become the fundamental building blocks in your Python journey.


Hello, World!

Printing "Hello, World!" has become a "rite of passage" for someone starting to learn programming. The program below uses the  print( )  function to show you the output which is a string(text) that says "Hello, World!". Keep this function in mind as we will need to use it in Section 1.2 and 1.3 before we talk about it in Section 1.4.

 Run your first Python program by clicking the Run button! 

Programming is the process of creating a set of instructions that tell a computer how to perform a task. It allows us to design how we want a computer to do a certain task and solve problems.

Python is a High-Level Programming language. High-Level means the language is closer to human language instead of machine language (more independent of a particular type of computer). It was created in 1991 by a guy named Guido van Rossum and it was designed to emphasize code readability.

Some Applications of Python Programming:

  1. Web Development
  2. Machine Learning to predict trends
  3. Building game applications
  4. Data Analysis
  5. Automate certain mundane/repetitive tasks such as
    • Sending mass emails from a list of recipients
    • Search for text in a file or across multiple files
    • Create, update, move, and rename files and folders
    • Send reminder emails and text notifications
    • And more!

Programming can perform almost anything!

Syntax is a set of rules defined by the programming language. Syntax is essential in letting your computer understand exactly what you are trying to say in your code. If you do not follow these set of rules, you may come across syntax error, and your programme may not work correctly.

Examples of syntax errors: 

  • an extra dot or comma in your code
  • a missing semicolon at the end of a set of codes

How to use Python - An Introduction to IDEs/IDLEs

Python can be run using Integrated Development Environment (IDE) / Integrated Development Learning Environment (IDLE).

IDE is a software environment which usually consist of a software development package containing Code Editor, Build Automation, Tools and Debugger. IDLE is the specific IDE for Python.

We will use IDEs to write, read and execute Python codes so that we can perform the tasks we require.

Browser-based IDEs (Beginner friendly!) :

  1. trinket.io
  2. Repl.it
  3. Python Tutor (View how codes work step-by-step)


Types of IDEs that you can download for Python :

  1. JupyterLab
  2. PyCharm
  3. RStudio

 

Steps to install and create your first workbook (PDF with step by step illustration available in Downloads Box)
 

  1. Go to Anaconda Webpage.
  2. Scroll down to select your preferred OS and select the 64-bit installer (Python 3.7 version) if your machine runs on 64-bit, or alternatively select the 32-bit installer.
  3. Launch the installer, and follow the recommended settings during the installation.
  4. Click on the “Jupyter Lab” tile
  5. Click on the file browser tab and select a folder to create your first workbook on
  6. Create a new workbook under the “Notebook” section in the main page