Arithmetic, Assignment & Comparison Operators

Operators in Python are symbols that help you perform calculations, update values, and compare data. In data analysis, you use them constantly for creating new columns, building filters, and applying business rules.

Arithmetic operators are used for mathematical calculations. The most common ones are + (addition), – (subtraction), * (multiplication), and / (division). Python also supports // for floor division, which gives the whole-number part of a division, and % for modulus, which gives the remainder. These are useful when you want to group items, check even or odd numbers, or create buckets. Another important operator is ** for exponent, used for powers. In analysis tasks, arithmetic operators help you compute totals, growth rates, averages, ratios, and percentage changes.

Assignment operators are used to store or update values in variables. The basic assignment operator is =, which assigns a value to a variable. Python also provides shortcut assignment operators that combine calculation and assignment. For example, += adds a value and updates the variable, -= subtracts and updates, *= multiplies and updates, and /= divides and updates. These shortcuts are common in loops and running totals, such as adding up sales amounts row by row.

Comparison operators are used to compare values and return True or False. The main ones are == (equal to), != (not equal to), > (greater than), < (less than), >= (greater than or equal to), and <= (less than or equal to). These are essential for conditions and filtering data. For example, you may check whether sales > 10000, whether status == “Approved”, or whether a date <= a cutoff date. Comparison results are often used inside if statements, while loops, and filtering rules in data analysis.

Understanding these three operator groups helps you write logic correctly, avoid mistakes in calculations, and build accurate decision rules for real datasets.

String Formatting
Conditional Statements

Get industry recognized certification – Contact us

keyboard_arrow_up