Online · Tampines · Singapore

Artificial Intelligence Course for Young Learners in Tampines, Singapore

An artificial intelligence course for young learners in Tampines, Singapore introduces how computers learn from examples—through visual tools, pattern labs and clear talk about responsible AI use.

AI course Tampines

1. Introduction: Accessing and Modifying DataFrame Subsets

Once a dataset is loaded into a DataFrame, data scientists rarely process the entire table at once. Machine learning preprocessing, exploratory analysis, and data cleaning require accessing, filtering, and modifying specific subsets of data.

Pandas provides two primary methods for subset selection:

  1. loc (Location) — label-based selection
  2. iloc (Index Location) — integer position-based selection
  • df.loc[row_labels, col_labels] — label-based; slicing includes both start and end boundaries
  • df.iloc[row_positions, col_positions] — integer positions; slicing excludes the end boundary
  • Boolean indexing: df[df['Column'] > value]
  • Conditional assignment: df.loc[condition, col] = value

2. Environment Setup: Creating the Sample DataFrame

Import Pandas as pd and build a DataFrame with four features (Name, Age, City, Salary) and four records:

import pandas as pd

# Creating a DataFrame with 4 features and 4 records
data = {
    "Name": ["Alice", "Bob", "Charlie", "David"],
    "Age": [25, 35, 28, 42],
    "City": ["New York", "London", "Paris", "Tokyo"],
    "Salary": [70000, 85000, 62000, 95000]
}

df = pd.DataFrame(data)
print(df)

Output structure (default row indices 0–3):

      Name  Age      City  Salary
0    Alice   25  New York   70000
1      Bob   35    London   85000
2  Charlie   28     Paris   62000
3    David   42     Tokyo   95000

3. Label-Based Selection: df.loc

The df.loc indexer selects data using row and column labels.

Syntax: df.loc[row_selection, column_selection].

# Selecting rows with labels 1 to 3, and columns 'Name' and 'Salary'
subset_loc = df.loc[1:3, ["Name", "Salary"]]
print(subset_loc)
      Name  Salary
1      Bob   85000
2  Charlie   62000
3    David   95000
  • Row labels here match default indices (0, 1, 2, 3).
  • Columns are selected by name: "Name" and "Salary".
  • Critical rule for loc: both endpoints are included — 1:3 returns labels 1, 2, and 3 (three rows).

4. Position-Based Selection: df.iloc

The df.iloc (Integer Location) indexer selects strictly by zero-based integer positions for rows and columns.

Syntax: df.iloc[row_positions, column_positions].

# Selecting row indices 0:2 and column indices 1:3
subset_iloc = df.iloc[0:2, 1:3]
print(subset_iloc)
   Age      City
0   25  New York
1   35    London
  • Rows 0:2 → indices 0 and 1 (stop 2 excluded).
  • Columns 1:3 → Age and City (column 3 Salary excluded).

5. Key Difference: Boundary Inclusivity (loc vs. iloc)

Indexer Based On Start End Example (1:3)
df.loc Labels / names Included Included Labels 1, 2, 3 (3 records)
df.iloc Integer positions Included Excluded Positions 1 and 2 (2 records)

In iloc, the endpoint is excluded (standard Python slicing). In loc, both endpoints are included because labels are identifiers, not offsets.

6. Boolean Indexing: Filtering Rows with Conditions

# Filtering records where Salary is greater than 75,000
high_salary = df[df["Salary"] > 75000]
print(high_salary)
    Name  Age    City  Salary
1    Bob   35  London   85000
3  David   42   Tokyo   95000

Only Bob (85,000) and David (95,000) satisfy the condition.

7. Modifying Data Subsets Using df.loc

Using column labels with loc is preferred over integer positions: large tables make counting columns error-prone, and reordering or adding columns would break positional code.

Example — set salary to 65,000 for employees under age 30:

# Targeting rows where Age < 30 and updating the 'Salary' column
df.loc[df["Age"] < 30, "Salary"] = 65000

# Inspecting records where Age < 30 to verify the change
print(df[df["Age"] < 30])
      Name  Age      City  Salary
0    Alice   25  New York   65000
2  Charlie   28     Paris   65000

Alice and Charlie are updated; the filtered print confirms both now show 65000.

Lesson Q&A

df.loc is label-based: it selects by row/column names or labels (e.g. df.loc[1:3, ['Name', 'Salary']]). df.iloc is integer position-based: it selects by zero-based numerical positions regardless of labels (e.g. df.iloc[0:2, 1:3]).

With df.loc, both start and end are included — df.loc[1:3] returns labels 1, 2, and 3 (three rows). With df.iloc, the end is excluded — df.iloc[1:3] returns positions 1 and 2 only (two rows).

Counting column positions by hand is error-prone on wide tables. If columns are inserted or reordered, positional indices shift and iloc can hit the wrong field. Labels with df.loc (e.g. df.loc[df['Age'] < 30, 'Salary'] = 65000) target the correct feature reliably and keep the code readable.

What children can learn

Enquire about artificial intelligence course for young learners tampines singapore

WhatsApp +92 322 421 7059

AI and Robotics Club | The 100 Mission AI & Robotics Hero Journey

100 Mission playlist · WhatsApp community · Saturday live 12–1 PM GMT

Recommended self-paced course for parents & educators

ChatGPT for Kids on Udemy — a structured option families can explore alongside live mentoring.

Disclosure: This page contains affiliate links. We may earn from qualifying purchases at no extra cost to you. Links are intended for parents and educators, not as marketing directed at young children.

Patterns and Predictions: Age-Appropriate AI for East Singapore Families

Tampines families exploring AI need concrete, supervised experiments rather than hype. Courses show how training examples shape predictions and why models can make mistakes. Students never share personal data, passwords or private family details with AI tools. A standard home computer is enough.

Digital safety and critical evaluation of AI output are emphasised throughout. Enquire support@aiandroboticsclub.com or WhatsApp +92 322 4217059. We do not guarantee career outcomes; we focus on genuine understanding of patterns, data and responsible use.

Parent guidance

Ask your child to explain one idea in their own words. Prefer guiding questions over completing the work for them. Supervise online accounts and any hardware. We do not invent prices, campus addresses or guaranteed academic outcomes.

How to enquire

Contact WhatsApp +92 322 4217059 or support@aiandroboticsclub.com. Primary delivery: interactive online learning in English. Singapore-friendly timing can be discussed on enquiry.

Frequently asked questions

Is artificial intelligence too complex for primary school students in Tampines?

Not at all! Our AI course for young learners in Tampines breaks down machine learning, computer vision, and facial recognition into fun, visual exercises using beginner-friendly tools like mBlock and Scratch.

What key AI skills will Tampines students gain upon finishing this course?

Students learn how algorithms process data, train simple image recognition models, and evaluate ethical AI usage, preparing them for future school technology tracks in Singapore.

Can we try a sample AI session before committing to a full term in Tampines?

Yes, we offer a dedicated 1-on-1 trial class. Reach out via WhatsApp to schedule your child's free trial class at a time that fits your family's routine.

Explore related learning

Orchard roboticsOnline Robotics · Orchard Bukit Timah ArduinoArduino · Bukit Timah Novena CTComputational Thinking · Novena

Related pages