This post is the first part of a series on the Python Basics. In this series, we’ll teach you about the very basics of the Python programming language. In Part 1, you’ll be learning about the most popular data types, the Arithmetic Operators, and the Print and Comment command used in Python. Part Two has been posted.
If you want to use the Nexus as your Python editor, then you will find instructions at the end of the blog on how to set this up!
You are about to go on a journey in the data jungle looking for python. I am going to make this lesson safe, fun, and educational. My goal is to build your confidence with the basics of Python so you will be ready to take your knowledge even deeper.
If you have a Python editor you want to use then you are all ready to go, but if you want an easy way to try these examples then go to www.CoffingDW.com and download the Nexus. Once you have it installed, just look at the picture below and see where the Python editor of Nexus exists.
The Five Most Popular Data Types of Python
There are five major data types listed below that are predominantly used in Python.
The Seven Arithmetic Operators of Python
Arithmetic Operators allow for Python users to perform math. The basics of addition, subtraction, division, and multiplication plus more allow users to apply simple math as well as advanced mathematical concepts. This module will show you how to start with baby steps and begin your journey towards brilliant analytics.
Try these examples on for size.
The examples below are designed to show how Python uses the arithmetic operators in an order of precedence. You can change the precedence by using parenthesis.
The Print Command
The Print Command is used to display information. Notice that we are using double quotes in the first command and single quotes in the second command. These are interchangeable in Python.
The Print Command is lower case
The Print Command is used to display information. In the below picture, we didn’t spell print in lowercase letters and therefore Python did not recognize the Print Command. An error was received for both commands because an upper-case letter was found.
If you want to make comments in your code, you can use a # (pound sign). Everything else after that is considered a comment and will not be part of the input into Python or impact the result in any way.
How to Install and Setup Python on your Nexus
- Download the latest version of Nexus from our website. https://www.coffingdw.com/nexus-trial/
- Once installed download Python for Windows. https://www.python.org/downloads/windows/
Your version number can vary, but you will want to download the Windows installers. So for Python for Windows 3.7.3 located here (https://www.python.org/downloads/release/python-373/) you will select one of these highlighted links:
Note: Nexus comes in three versions: Nexus 64-bit, Nexus 32-bit, and Nexus WOW-64 (For 64-bit machines with 32-bit Microsoft Office installed).X86-64 can be used for the 64-bit or Wow64 version of Nexus and x86 can be used only on the 32-bit version of Nexus.
When installing, if you have the option, select “Add Python to PATH”.
If you are using an older version of Python and do not have this option, then you will need to add the path to your python executable to your PATH environment variable. Be careful when editing this variable as it can affect many Windows functionality issues. If you don’t feel comfortable about this then consult with your desktop support.
Python 3.7.3 was installed in the following directory on our PC.
You can view your Python directory by opening File Explorer and pasting in the following path:
Once you have the path to the python.exe executable then add it to your Environment PATH variable by following the direction in this link:
And that is how you install Python into the Nexus Query Chameleon!
Tom Coffing, better known as Tera-Tom, is the founder of Coffing Data Warehousing where he has been CEO for the past 25 years. Tom has written over 75 books on all aspects of Teradata, Netezza, Yellowbrick, Snowflake, Redshift, Aurora, Vertica, SQL Server, and Greenplum. Tom has taught over 1,000 classes worldwide, and he is the designer of the Nexus Product Line.