You do not need to be a software developer to analyze data with Python. You need a small, reliable core: variables, a handful of data structures, loops, functions and the habit of running code in small steps. This module covers that core; the rest of the course builds on it.
Getting a working environment
- Quickest: Google Colab or another hosted notebook. Nothing to install, and pandas is already available.
- On your own machine: install Python 3 from python.org or a distribution such as Anaconda, then run
pip install pandas numpy matplotlib seaborn plotly. Use Jupyter notebooks or VS Code with the Python extension.
Notebooks suit analysis because you run code cell by cell and see each result immediately. Keep each cell short; when something breaks, you will know where.
Values and types
revenue = 1250.50 # float
orders = 42 # int
region = "North" # str
is_active = True # bool
missing = None # no value
print(type(revenue), round(revenue / orders, 2))
Watch for the most common type surprise in data work: numbers stored as text. "42" + "8" gives "428", not 50. Convert with int() or float(), and in pandas with pd.to_numeric() (Module 4).
f-strings
print(f"{region}: {orders} orders, average {revenue / orders:.2f}")
The :.2f formats to two decimal places. f-strings are the clearest way to build labels and messages.
Try this
Open a notebook and create variables for a product name, units sold and unit price. Print a sentence with the revenue formatted to two decimals with a thousands separator ({value:,.2f}).