Fundamentals of Business Analytics

Online B.Com · Sem 5

Lesson 4 of 4Analytics

Python Basics for Beginners

Fundamentals of Business Analytics

About the video

Learn Python Basics in Just 20 Minutes!

Kenji Explains

Study notes

Python is a readable, general-purpose language widely used in business analytics. The basics are variables and data types, operators, collections, control flow, functions, and libraries such as pandas.

Variables and Data Types

  • Variables are assigned with =, e.g. price = 19.99; no type declaration is needed.
  • Core types: int (5), float (3.14), str ('text'), bool (True/False).
  • type(x) shows a value's type; int(), float() and str() convert between types.

Operators and Collections

  • Arithmetic operators: + - * /, plus // (floor division), % (remainder) and ** (power).
  • list: ordered and mutable, e.g. [1, 2, 3]; indexing starts at 0.
  • tuple: ordered and immutable; dict: key-value pairs, e.g. {'region': 'East'}; set: unique values.

Control Flow and Functions

  • if / elif / else for decisions; indentation defines code blocks.
  • for loops iterate over sequences; while loops repeat while a condition is true.
  • Functions are defined with def name(params): and return values with return.

Libraries for Analytics

  • import pandas as pd for tabular data (DataFrames); numpy for numerical work.
  • matplotlib and seaborn for charts.

Key terms

Variable
A name that refers to a stored value.
List
An ordered, mutable collection of items.
Dictionary
A collection of key-value pairs.
Function
A reusable block of code defined with def.
pandas
A Python library for working with tabular data in DataFrames.

Takeaways

  • Python indexing starts at 0.
  • Indentation is part of the syntax.
  • Lists are mutable and tuples are immutable.
  • pandas is the core library for analysing business data.
Contribute

Was this lesson helpful?

We read every rating and fix the weakest lessons first.