Python – Data Science Intro

So, you’ve heard the buzzword — Python, right?
But do you really know how deep the rabbit hole goes? 🧠

Before diving into Data Science with tools like NumPy, Pandas, and Matplotlib, let’s unlock the mysterious core of Python — step by step.


🧠 BASIC LEVEL — The Mysterious Start of Python

Python isn’t just a programming language — it’s a way to make your computer think logically and work magically.

You don’t need a computer science degree to begin. All you need is curiosity, and we’ll take care of the rest!

Let’s begin by exploring Python’s core data structures — the foundation of everything you’ll build later.


🔢 The 5 Pillars of Python Data

Data TypeMutable / ImmutableOrdered / UnorderedDuplicate AllowedSyntax ExampleCommon Use Case
StringImmutableOrderedYes"Hello"Text, Names, Messages
ListMutableOrderedYes[10, 20, 30]Storing multiple values
TupleImmutableOrderedYes(10, 20, 30)Fixed data (like coordinates)
SetMutableUnordered❌ No{10, 20, 30}Unique elements, fast lookup
DictionaryMutableOrdered (from 3.7+)Keys: No{"name":"Ram", "age":25}Key-value storage

💡 Tip:

  • “Mutable” means you can change the data.
  • “Immutable” means it’s fixed once created.

For example:

name = "CSC"
name[0] = 'P'   # ❌ Error - Strings are immutable

But:

students = ["Arun", "Bala", "Charu"]
students[0] = "Anu"   # ✅ Works fine - Lists are mutable

⚙️ INTERMEDIATE LEVEL — The Logic Builder

Now that you understand Python’s building blocks, let’s add some logic and power to your code.


🧩 Functions — The Reusable Magic

A function is a reusable block of code that performs a specific task.

def greet(name):
    return f"Hello {name}, Welcome to CSC Pallavaram!"

print(greet("Anitha"))

Output:

Hello Anitha, Welcome to CSC Pallavaram!

Functions help make your code clean, organized, and efficient.


⚡ Lambda — The Anonymous Shortcut

What if you could write the same function in one line?

That’s what Lambda functions do!

square = lambda x: x*x
print(square(5))

Output:

25

✅ Best used for short, simple operations (like filters, sorting, or one-time tasks).


💡 List & Dictionary Comprehension — The Pythonic Shortcut

Instead of writing loops, do it the smart way 😎

List Comprehension:

nums = [1, 2, 3, 4, 5]
squares = [n**2 for n in nums]
print(squares)

Dictionary Comprehension:

names = ["Ram", "Bala", "Sara"]
rolls = [101, 102, 103]
data = {name: roll for name, roll in zip(names, rolls)}
print(data)

Output:

{'Ram': 101, 'Bala': 102, 'Sara': 103}

🧮 Built-in Python Modules — Hidden Superpowers

Python comes with ready-made modules to save your time. Let’s explore a few essential ones:

ModulePurposeExample
mathMathematical functionsmath.sqrt(25) → 5.0
randomRandom numbersrandom.randint(1,10)
datetimeDate & time handlingdatetime.datetime.now()
osOperating System commandsos.getcwd() (current directory)
sysSystem-specific infosys.version (Python version)

These are the pre-installed tools every Python programmer must know before stepping into the world of Data Science.


🧩 ADVANCED LEVEL — Before Data Science

You’re almost there!
Before installing heavy libraries like numpy or pandas, you must learn two powerful tools:
Virtual Environment and Pip Installation.


🌐 Virtual Environment Setup (venv)

A virtual environment lets you create an isolated Python workspace — where you can install your own packages without affecting the system.

Create a Virtual Environment:

python -m venv myenv

Activate the Environment:

Windows: myenv\Scripts\activate
Mac/Linux: source myenv/bin/activate

Deactivate:

deactivate

Now your environment is clean, ready, and specific for each project.


📦 Installing Libraries using pip

pip (Python Installer Package) is your gateway to installing any Python library from the internet.

Example:

pip install numpy
pip install pandas
pip install matplotlib

To check installed packages:

pip list

To update pip itself:

python -m pip install --upgrade pip

🚀 Final Note

Before becoming a Data Scientist, learn to think like a Pythonista!
Once you master:

  • Basics (Strings, Lists, Tuples, Sets, Dictionary)
  • Intermediate (Functions, Comprehensions, Modules)
  • Advanced (Virtual Env, pip)

You’ll be fully ready to step into the Data Science world with confidence! 💪


📍Learn Python & Data Science at:

CSC Computer Education, Pallavaram Centre
📚 Learn. Code. Create. Transform.


Leave a Reply

Your email address will not be published. Required fields are marked *