---
title: "DataFrame Class 12 IP: Notes, loc and iloc, Programs"
description: "DataFrame class 12 IP (065) for 2026-27: creation, loc and iloc, add, rename, delete, Boolean indexing, CSV, 12 output questions and tested programs."
canonical: https://learn.modernagecoders.com/cbse-class-12-informatics-practices-dataframe
source: src/pages/cbse-class-12-informatics-practices-dataframe.html
---
> DataFrame class 12 IP (065) for 2026-27: creation, loc and iloc, add, rename, delete, Boolean indexing, CSV, 12 output questions and tested programs.

Start here

## Three ways to get more table practice

Tables run through all three. The IP course treats them as a board topic, data science treats them as evidence, and MySQL asks the same questions in another language.

[![Informatics Practices Class 11 and 12 course thumbnail](/images/ip-cs-class-11-12.webp)  065 / Board topic Informatics Practices 11 and 12 DataFrame creation and operations taught after Series, then CSV work, Matplotlib, SQL and the theory units. Open the course →](/courses/cbse-informatics-practices-ip-class-11-12-python-pandas-sql-complete-course)[![Data Science for Teens course thumbnail](/images/data-science-teens.webp)  Tables as evidence Data Science for Teens Filtering and sorting, grouping, combining and cleaning real datasets, for a student who wants to go further than 065. Open the course →](/courses/data-science-course-for-teens-python-data)[![MySQL for Teens course thumbnail](/images/mysql-teens.webp)  Same table, SQL MySQL for Teens WHERE is Boolean indexing in another language. This course takes SQL from a first SELECT to joins. Open the course →](/courses/mysql-mastery-for-teens)

Ans. The short version

A DataFrame in Class 12 IP is the two-dimensional data structure of pandas: rows and columns, each with labels, where every column is a Series. The CBSE 065 syllabus for 2026-27 asks for creation from a dictionary of Series, a list of dictionaries and text or CSV files; display and iteration; adding, selecting, deleting and renaming rows and columns; head() and tail(); label indexing; Boolean indexing; and CSV import and export. Modern Age Coders teaches it personalised one to one at your own hours. Try a full class first with a priority demo.

Step 1. Make the table

## What is a DataFrame, and how is it created in Class 12 IP?

A DataFrame is a table with labelled rows and labelled columns. The syllabus lists three sources for creating one: a dictionary of Series, a list of dictionaries, and a text or CSV file.

***List of dictionaries**program*

```
import pandas as pd

hire = [
  {"Model": "Roadie", "Kind": "City", "Rate": 60, "Days": 4},
  {"Model": "Hillup", "Kind": "Gear", "Rate": 110, "Days": 2},
  {"Model": "Breeze", "Kind": "City", "Rate": 50, "Days": 6},
  {"Model": "Summit", "Kind": "Gear", "Rate": 130, "Days": 3},
  {"Model": "Pebble", "Kind": "Kids", "Rate": 40, "Days": 5}]

cycles = pd.DataFrame(hire, index=["C1", "C2", "C3",
                                   "C4", "C5"])
cycles.to_csv("cycles.csv")          # used by later programs
print(cycles)
```

***What it printed**pandas 2.3*

```
     Model  Kind  Rate  Days
C1  Roadie  City    60     4
C2  Hillup  Gear   110     2
C3  Breeze  City    50     6
C4  Summit  Gear   130     3
C5  Pebble  Kids    40     5
```

One dictionary is one row, and its keys are the column names. The last line but one saves the table, so run this program first.

***Dictionary of Series**program*

```
import pandas as pd

charge = pd.Series({"Helmet": 40, "Lock": 15})
given = pd.Series({"Lock": 9, "Pump": 3})

extras = pd.DataFrame({"Charge": charge, "Given": given})
print(extras)
```

***What it printed**pandas 2.3*

```
        Charge  Given
Helmet    40.0    NaN
Lock      15.0    9.0
Pump       NaN    3.0
```

Here one Series is one column. Row labels are collected from both, and a missing pair is NaN.

***Text file**program*

```
import pandas as pd

with open("routes.txt", "w") as f:       # make the file once
    f.write("Lake loop;12\n")
    f.write("Fort climb;7\n")
    f.write("River path;19\n")

routes = pd.read_csv("routes.txt", sep=";", header=None,
                     names=["Route", "Km"])
print(routes)
```

***What it printed**pandas 2.3*

```
        Route  Km
0   Lake loop  12
1  Fort climb   7
2  River path  19
```

`sep` names the character between values. `header=None` says the file has no line of column names, and `names` supplies them.

### Which is a row, which is a column?

In a list of dictionaries, each dictionary lies flat as a row. In a dictionary of Series, each Series stands up as a column.

### When lengths differ

Series of two and three values still make a DataFrame, with NaN in the gap. Question 28 of the sample paper gives two dictionaries, one with an extra key.

### Display

`print(cycles)` shows it all. `cycles.head(2)` gives the first two rows and `cycles.tail(2)` the last two; with no number, five. `head(-3)` leaves the last three out.

Step 2. Reach any part of it

## What is the difference between loc and iloc in Class 12?

loc uses labels and includes the end of a slice. iloc uses positions counted from 0 and leaves the end out. Both take the row first and the column second, with a comma between.

***Columns, rows and a cell**program*

```
import pandas as pd
cycles = pd.read_csv("cycles.csv", index_col=0)

print(cycles["Rate"].head(2))             # a Series
print(cycles[["Model", "Rate"]].tail(2))  # a DataFrame
print(cycles.loc["C4"])                   # one row
print(cycles.loc["C2":"C4", "Rate":"Days"])
print(cycles.loc["C3", "Model"])          # one cell
```

***What it printed**pandas 2.3*

```
C1     60
C2    110
Name: Rate, dtype: int64
     Model  Rate
C4  Summit   130
C5  Pebble    40
Model    Summit
Kind       Gear
Rate        130
Days          3
Name: C4, dtype: object
    Rate  Days
C2   110     2
C3    50     6
C4   130     3
Breeze
```

`index_col=0` makes the first column of the file the row labels. One column or one row prints as a Series, with its name at the bottom.

### loc and iloc on the same cycles

| You want | With labels | With positions |
| --- | --- | --- |
| One row | `cycles.loc["C2"]` | `cycles.iloc[1]` |
| Rows C2 to C4 | `cycles.loc["C2":"C4"]` | `cycles.iloc[1:4]` |
| One cell, the rate of C1 | `cycles.loc["C1", "Rate"]` | `cycles.iloc[0, 2]` |
| A block | `cycles.loc["C2":"C4", "Kind":"Days"]` | `cycles.iloc[1:4, 1:4]` |
| A whole column | `cycles.loc[:, "Model"]` or `cycles["Model"]` | `cycles.iloc[:, 0]` |
| Rows in your own order | `cycles.loc[["C5", "C1"]]` | `cycles.iloc[[4, 0]]` |
| Something that is not there | `cycles.loc["C9"]` KeyError | `cycles.iloc[7]` IndexError |

A single label in plain square brackets means a column, so `cycles["C1"]` is a KeyError. A slice in plain square brackets means rows: `cycles[0:2]` is the first two. Two columns need a list inside the bracket, `cycles[["Model", "Rate"]]`; with one pair of brackets it is a KeyError.

***When labels are numbers**program*

```
import pandas as pd

routes = pd.read_csv("routes.txt", sep=";", header=None,
                     names=["Route", "Km"])
print(routes.loc[0:1])        # labels 0 and 1: two rows
print(routes.iloc[0:1])       # position 0 only: one row

routes = routes.drop(0)       # labels left: 1 and 2
print(routes.iloc[0])
```

***What it printed**pandas 2.3*

```
        Route  Km
0   Lake loop  12
1  Fort climb   7
       Route  Km
0  Lake loop  12
Route    Fort climb
Km                7
Name: 1, dtype: object
```

With labels 0, 1, 2 the two look alike until you slice, or until a row is deleted. After the drop, `routes.loc[0]` is a KeyError and `routes.iloc[0]` is the old second row.

**What the syllabus says.** The 065 document lists "Indexing using Labels" and Boolean indexing for DataFrames. It does not name iloc. Learn loc for writing answers and iloc for reading code that uses it.

Step 3. Change it

## How do you add, rename and delete rows and columns in a DataFrame?

A new label in square brackets adds a column, a new label in loc adds a row, rename() changes labels and drop() deletes. For drop(), axis 0 is rows, which is the default, and axis 1 is columns.

***Five changes to one table**program*

```
import pandas as pd
cycles = pd.read_csv("cycles.csv", index_col=0)

cycles["Income"] = cycles["Rate"] * cycles["Days"]
cycles["Shop"] = "Lakeside"          # same for all
cycles.loc["C6"] = ["Zippy", "Kids", 35, 2, 70, "Fort"]
print(cycles)

cycles = cycles.rename(columns={"Kind": "Type"},
                       index={"C6": "C9"})
cycles = cycles.drop(["C2", "C3"])           # rows
cycles = cycles.drop("Shop", axis=1)         # a column
print(cycles)
```

***What it printed**pandas 2.3*

```
     Model  Kind  Rate  Days  Income      Shop
C1  Roadie  City    60     4     240  Lakeside
C2  Hillup  Gear   110     2     220  Lakeside
C3  Breeze  City    50     6     300  Lakeside
C4  Summit  Gear   130     3     390  Lakeside
C5  Pebble  Kids    40     5     200  Lakeside
C6   Zippy  Kids    35     2      70      Fort
     Model  Type  Rate  Days  Income
C1  Roadie  City    60     4     240
C4  Summit  Gear   130     3     390
C5  Pebble  Kids    40     5     200
C9   Zippy  Kids    35     2      70
```

The added row needs one value for each column in order, including Income, which is not worked out for you.

### Add, rename, delete: the forms and their failures

| Task | Statement | If it goes wrong |
| --- | --- | --- |
| Add a column from a list | `cycles["Seats"] = [1, 1, 1, 1, 1]` | A list of the wrong length: ValueError |
| Add a column with one value | `cycles["Shop"] = "Lakeside"` | Nothing: the value is repeated |
| Add or replace a row | `cycles.loc["C6"] = ["Zip", "Kids", 35, 2]` | Too few values: ValueError. A label that exists is overwritten |
| Rename a column | `cycles.rename(columns={"Kind": "Type"}, inplace=True)` | A wrong old name is ignored, with no error |
| Delete a column | `cycles.drop("Kind", axis=1, inplace=True)` | Without axis=1: KeyError, because pandas looks for a row |
| Delete a column, another way | `del cycles["Kind"]` | Works at once, nothing to store |
| Delete rows | `cycles.drop(["C2", "C3"], inplace=True)` | Without inplace=True or storing it, the table is unchanged |
| Change one cell | `cycles.loc["C1", "Days"] = 9` | Use one bracket. `cycles["Days"]["C1"] = 9` changed the table on pandas 2.3 and did not on 3.1 |

Older notes use `df.append()` for a row and `df.iteritems()` for columns. pandas 2 and later have neither: both raise AttributeError. Use `loc` and `items()`.

Step 4. Question it, then save it

## Boolean indexing, iteration and CSV files in pandas

Boolean indexing selects rows by a condition: the condition gives True or False for each row, and only the True rows are kept. Iteration walks through the table one row or one column at a time. to_csv() saves it and read_csv() brings it back.

***Boolean indexing**program*

```
import pandas as pd
cycles = pd.read_csv("cycles.csv", index_col=0)

print(cycles["Rate"] > 55)
print(cycles[cycles["Rate"] > 55])
print(cycles[(cycles["Rate"] > 55) & (cycles["Days"] > 2)])
print(cycles.loc[cycles["Kind"] == "City", ["Model", "Days"]])
```

***What it printed**pandas 2.3*

```
C1     True
C2     True
C3    False
C4     True
C5    False
Name: Rate, dtype: bool
     Model  Kind  Rate  Days
C1  Roadie  City    60     4
C2  Hillup  Gear   110     2
C4  Summit  Gear   130     3
     Model  Kind  Rate  Days
C1  Roadie  City    60     4
C4  Summit  Gear   130     3
     Model  Days
C1  Roadie     4
C3  Breeze     6
```

The first output is the condition alone. Inside the square brackets it becomes a filter. Join conditions with & or |, each one in round brackets; the words `and` and `or` raise ValueError. Text must match in case, so "city" finds no rows.

***Iteration**program*

```
import pandas as pd
cycles = pd.read_csv("cycles.csv", index_col=0)

for label, row in cycles.iterrows():
    if row["Days"] >= 5:
        print(label, row["Model"], "is out for long")

for name, column in cycles.items():
    print(name, ":", column.iloc[0], "to", column.iloc[-1])
```

***What it printed**pandas 2.3*

```
C3 Breeze is out for long
C5 Pebble is out for long
Model : Roadie to Pebble
Kind : City to Kids
Rate : 60 to 40
Days : 4 to 5
```

iterrows() gives a label and a row, items() gives a name and a column.

***What is inside the CSV file**program*

```
import pandas as pd

with open("cycles.csv") as f:
    print(f.readline(), end="")
    print(f.readline(), end="")

plain = pd.read_csv("cycles.csv")
print(list(plain.columns))
print(plain.head(1))

plain = pd.read_csv("cycles.csv", index_col=0)
plain.to_csv("rates.txt", sep="|", index=False,
             columns=["Model", "Rate"])
with open("rates.txt") as f:
    print(f.read())
```

***What it printed**pandas 2.3*

```
,Model,Kind,Rate,Days
C1,Roadie,City,60,4
['Unnamed: 0', 'Model', 'Kind', 'Rate', 'Days']
  Unnamed: 0   Model  Kind  Rate  Days
0         C1  Roadie  City    60     4
Model|Rate
Roadie|60
Hillup|110
Breeze|50
Summit|130
Pebble|40
```

The row labels were saved under a blank heading, and read_csv() calls that column Unnamed: 0.

| Argument | Function | What it does |
| --- | --- | --- |
| `index=False` | to_csv | Leaves the row labels out of the file |
| `header=False` | to_csv | Leaves the column names out of the file |
| `sep="\|"` | both | Sets the separator; without it, a comma |
| `index_col=0` | read_csv | Uses the first column as row labels |
| `header=None` | read_csv | Says the first line is data, not names |
| `names=[...]` | read_csv | Gives column names |

Step 5. Board shapes

## Class 12 IP DataFrame questions, with outputs and programs

In the 2026-27 sample paper the DataFrame is asked as one-mark choices, two-mark explanations, three statements for three marks and a five-mark table. Start with the outputs: pandas is imported as pd in all of them.

1. ```
  d = [{"p": 1, "q": 2}, {"q": 5, "r": 7}]
  print(pd.DataFrame(d))
  ```

  Check

  ```
       p  q    r
  0  1.0  2  NaN
  1  NaN  5  7.0
  ```

  Three different keys, so three columns. Only q has no gap, so only q stays int.
2. ```
  a = pd.Series([3, 4], index=["x", "y"])
  b = pd.Series([6, 8], index=["y", "z"])
  print(pd.DataFrame({"A": a, "B": b}))
  ```

  Check

  ```
       A    B
  x  3.0  NaN
  y  4.0  6.0
  z  NaN  8.0
  ```

  The row labels are all the labels of both Series. y is the only row with two values.
3. ```
  df = pd.DataFrame([{"n": 8}, {"n": 5}, {"n": 2}])
  df["m"] = df["n"] - 5
  print(df[df["m"] >= 0])
  ```

  Check

  ```
     n  m
  0  8  3
  1  5  0
  ```

  m is 3, 0 and -3. The rows that pass keep their own labels.
4. ```
  df = pd.DataFrame([{"n": 8}, {"n": 5}, {"n": 2}])
  print(len(df.loc[0:1]), len(df.iloc[0:1]), len(df[0:1]))
  ```

  Check

  ```
  2 1 1
  ```

  loc includes label 1. iloc and the plain row slice stop before position 1.
5. ```
  df = pd.DataFrame([{"u": 4, "v": 9}, {"u": 6, "v": 1}])
  df.drop("u", axis=1)
  print(df.shape)
  ```

  Check

  ```
  (2, 2)
  ```

  drop() returned a new DataFrame that was never stored. df still has both columns.
6. ```
  df = pd.DataFrame([{"u": 4, "v": 9}, {"u": 6, "v": 1}])
  df.loc[2] = [0, 0]
  df.loc[1] = [7, 7]
  print(df)
  ```

  Check

  ```
     u  v
  0  4  9
  1  7  7
  2  0  0
  ```

  Label 2 is new, so a row is added at the bottom. Label 1 exists, so that row is replaced.

1. ```
  df = pd.DataFrame([{"u": 4, "v": 9}], index=["k"])
  df = df.rename(columns={"v": "w", "t": "s"})
  print(list(df.columns), list(df.index))
  ```

  Check

  ```
  ['u', 'w'] ['k']
  ```

  v becomes w. There is no column t, and rename() ignores it silently.
2. ```
  df = pd.DataFrame([{"u": 4, "v": 9}, {"u": 6, "v": 1}])
  for name, col in df.items():
      print(name, col.iloc[1])
  ```

  Check

  ```
  u 6
  v 1
  ```

  items() goes column by column, and iloc[1] is the second value of each.
3. ```
  df = pd.DataFrame([{"u": 4, "v": 9}, {"u": 6, "v": 1}])
  print(df["u"] > df["v"])
  ```

  Check

  ```
  0    False
  1     True
  dtype: bool
  ```

  Comparing two columns gives a Series of True and False, one for each row.
4. ```
  df = pd.DataFrame([{"u": 4, "v": 9}, {"u": 6, "v": 1}],
                    index=["k", "m"])
  print(df.loc["m", "u"], df.iloc[0, 1], df["v"]["k"])
  ```

  Check

  ```
  6 9 9
  ```

  loc: row m, column u. iloc: row 0, column 1. The last form takes column v, then label k.
5. ```
  df = pd.DataFrame([{"u": 4}, {"u": 6}, {"u": 1}])
  df["z"] = pd.Series([10, 20], index=[2, 0])
  print(df)
  ```

  Check

  ```
     u     z
  0  4  20.0
  1  6   NaN
  2  1  10.0
  ```

  A Series given to a column is matched by label: 20 goes to row 0 and 10 to row 2.
6. ```
  rows = [{"u": i, "v": i * i} for i in range(1, 8)]
  df = pd.DataFrame(rows)
  print(df.tail(2))
  print(len(df.head()), df.head(1).size)
  ```

  Check

  ```
     u   v
  5  6  36
  6  7  49
  5 2
  ```

  head() alone is five rows. One row of two columns has size 2.

### Five marks: build, add, display

Make a DataFrame named trips from a dictionary of Series with the routes Lake loop (12 km, 31 riders) and Fort climb (7 km, 18 riders). Add River path, 19 km, 24 riders. Display only the Riders column.

***Answer**program*

```
import pandas as pd

data = {"Route": pd.Series(["Lake loop", "Fort climb"]),
        "Km": pd.Series([12, 7]),
        "Riders": pd.Series([31, 18])}
trips = pd.DataFrame(data)

trips.loc[2] = ["River path", 19, 24]      # new row
print(trips)
print(trips["Riders"])                     # one column
```

***What it printed**pandas 2.3*

```
        Route  Km  Riders
0   Lake loop  12      31
1  Fort climb   7      18
2  River path  19      24
0    31
1    18
2    24
Name: Riders, dtype: int64
```

The official split for this shape is 3 for the table, 1 for the new row and 1 for the column. Include the import line.

### Raise the rate of geared cycles only

***Answer**program*

```
import pandas as pd
cycles = pd.read_csv("cycles.csv", index_col=0)

gear = cycles["Kind"] == "Gear"
cycles.loc[gear, "Rate"] = cycles.loc[gear, "Rate"] + 20
print(cycles[["Model", "Rate"]])
```

***What it printed**pandas 2.3*

```
     Model  Rate
C1  Roadie    60
C2  Hillup   130
C3  Breeze    50
C4  Summit   150
C5  Pebble    40
```

The condition is stored once and used on both sides. Row and column go in a single loc.

### Copy chosen rows to a new CSV file

***Answer**program*

```
import pandas as pd

def long_hires(source, target, days):
    """Copy the rows with at least that many days."""
    table = pd.read_csv(source, index_col=0)
    chosen = table[table["Days"] >= days]
    chosen.to_csv(target, index=False)
    return len(chosen)

print("Rows saved:", long_hires("cycles.csv", "long.csv", 4))
print(pd.read_csv("long.csv"))
```

***What it printed**pandas 2.3*

```
Rows saved: 3
    Model  Kind  Rate  Days
0  Roadie  City    60     4
1  Breeze  City    50     6
2  Pebble  Kids    40     5
```

The new file has no row labels, so reading it back numbers the rows from 0.

### Total income by iteration

***Answer**program*

```
import pandas as pd
cycles = pd.read_csv("cycles.csv", index_col=0)

total = 0
for label, row in cycles.iterrows():
    total = total + row["Rate"] * row["Days"]
print("Income so far:", total)
```

***What it printed**pandas 2.3*

```
Income so far: 1350
```

240 + 220 + 300 + 390 + 200. Work it out on paper first, as a check.

### One and two marks

1. Which argument keeps row labels out of a file saved with to_csv()? Model answer`index=False`.
2. Name two differences between a Series and a DataFrame. Model answer A Series is one-dimensional and has one set of labels. A DataFrame is two-dimensional and has row labels and column labels, and its columns may be of different data types.
3. Explain Boolean indexing with one statement on the cycles table. Model answer Rows are selected by a True or False condition: `cycles[cycles["Days"] < 4]` gives C2 and C4.
4. **Assertion:**`cycles.drop("C1")` removes a row. **Reason:** The default axis of drop() is 0. Model answer Both are true and R explains A. The result still has to be stored, or inplace=True used.
5. What is the purpose of sep in read_csv()? Model answer It tells pandas which character separates the values. The default is a comma, so a file using semicolons needs `sep=";"`.

### Three statements, three marks

For the cycles table as first printed, write statements to (i) add a column Helmet holding "Yes" for all, (ii) rename Days to Period, (iii) delete the row C5.

Model answer

```
cycles["Helmet"] = "Yes"
cycles.rename(columns={"Days": "Period"}, inplace=True)
cycles.drop("C5", inplace=True)
```

One mark each. Each statement must change the table itself, so keep `inplace=True`.

### Find three errors

***Wrong on purpose**two marks*

```
cycles.drop("Rate")
print(cycles[cycles["Days"] > 3 and cycles["Kind"] == "City"])
print(cycles.loc["C2", "C4"])
```

Corrections`axis=1` is missing in the first line. The second needs & with each condition in round brackets. The third asks for a column named C4; for two rows write `cycles.loc[["C2", "C4"]]`.

### A pencil table

The student keeps the five cycles on paper and edits them by hand before each statement is run. Two copies that agree are proof.

### Same question, two ways

Every selection is written with a label and then with a condition, so that a question worded either way feels known.

### Back from the file

After each export the CSV is opened in a plain editor. Students who have seen the stray first column do not forget it.

If NaN still surprises you, go back to [pandas Series](/cbse-class-12-informatics-practices-pandas-series). To draw a table, go on to [Matplotlib charts](/cbse-class-12-informatics-practices-matplotlib-charts). Grouping and duplicate rows, which come from the suggested practical list, are in [the practical file](/cbse-class-12-informatics-practices-practical-file). For a whole paper, use the [IP sample paper](/cbse-class-12-informatics-practices-sample-paper-2026-27), and for a table of your own, [project topics](/cbse-class-12-informatics-practices-project-topics).

One to one, at your own timing

## One student, one table, one teacher

You write the statement, the teacher asks which rows will survive it, and only then does it run. That needs time with one person, so every class is personalised one to one and sits on the days and hours you give us. A priority demo shows you a complete class, with its fee set against your first month when you enrol; a free demo class is there too. Billing is monthly, admission is free of charge, and leaving at a month end needs no explanation.

Before you enrol · Try a class

### Priority demo, at a slot you pick

a full live class of about 45 to 60 minutes

- A table from your own textbook is built in two different ways
- Six loc and Boolean selections are written before any is run
- One five-mark question is answered by hand and marked part by part
- You receive a written report on the operations that need more work

[Book a priority demo](/book-demo)

The classes · Choose your own timing

### Personalised one to one

₹4,999

per month, 4 private classes, fully flexible timing

- Progress at your speed from creation to CSV export
- Extra rounds of loc, axis and inplace until they are automatic
- Pre-board and school test papers discussed question by question
- SQL and networks brought in when pandas is steady

Ask for a personalised plan

Some students know every command and still lose marks on brackets and commas. For them a class is mostly writing on paper and checking against the screen. You can see the monthly fee above, shown for your region.

Studying outside India?

## DataFrame help for IP students in any country

Whether school is in Dubai, Kathmandu or Pune, the 065 paper has the same table questions. The class is set by the clock on your own wall.

| Where you live | Time difference | Usual class window, local time | Format |
| --- | --- | --- | --- |
| India every Indian city | Indian time | Any time you choose | Personalised 1-on-1 |
| UAE and Oman Dubai, Abu Dhabi, Sharjah, Muscat | 1 h 30 min behind India | 3:00 PM to 9:00 PM | Personalised 1-on-1 |
| Saudi Arabia, Qatar, Kuwait, Bahrain Riyadh, Jeddah, Dammam, Doha, Kuwait City, Manama | 2 h 30 min behind India | 3:00 PM to 9:00 PM | Personalised 1-on-1 |
| Nepal Kathmandu | 15 min ahead of India | 4:30 PM to 9:00 PM | Personalised 1-on-1 |
| Ethiopia and East Africa Addis Ababa and East Africa Time | 2 h 30 min behind India | 4:30 PM to 9:00 PM | Personalised 1-on-1 |
| Singapore and Malaysia Singapore, Kuala Lumpur | 2 h 30 min ahead of India | 3:30 PM to 9:00 PM | Personalised 1-on-1 |

Please have pandas installed, or tell us that it is not, and a folder where your CSV files can stay between classes.

What families say

## Rated 4.9 across 547 Google reviews

Real reviews from real families. We neither write nor commission them.

★★★★★

"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."

Ria Mukherjee

Parent

★★★★★

"Modern Age Coders has been a game-changer for me. I struggled to grasp IT concepts and coding before joining, but their classes transformed everything. I can now confidently write complex programs with ease."

Samriddha Mondal

Student

★★★★★

"One of the most wonderful education centres out there. Education is not limited to school syllabus but focuses on skill development."

Vansh Agarwal

Student

★★★★★

"My child Dhairya is really enjoying the Modern Age Coders classes. This is his first online class and he eagerly looks forward to it. I can already see his improvement, and the teachers are very cooperative."

Sonam Oswal

Parent of Dhairya

★★★★★

"Modern Age Coders have wonderful teachers who teach in a clear, easy and practical way. The teacher boosts students' confidence and inspires them to learn without hesitation."

Sonu Goyal

Parent

★★★★★

"I highly recommend this computer coding class! The teachers are incredibly knowledgeable and passionate about coding."

Ritu Kedia

Parent

The rest of the Class 12 series

## More pages for Class 12 students

Every page in the CBSE Class 12 Informatics Practices series, grouped by what you need.

### Practicals, project and viva

- [Class 12 IP practical file](/cbse-class-12-informatics-practices-practical-file)
- [Class 12 IP project with source code](/cbse-class-12-informatics-practices-project)
- [Class 12 IP project topics](/cbse-class-12-informatics-practices-project-topics)
- [Class 12 IP viva questions](/cbse-class-12-informatics-practices-viva-questions)

### Exam, papers and marks

- [Class 12 IP sample paper practice](/cbse-class-12-informatics-practices-sample-paper-2026-27)
- [Class 12 IP syllabus and pattern](/cbse-class-12-informatics-practices-syllabus-and-paper-pattern)
- [Class 12 IP important questions](/cbse-class-12-informatics-practices-important-questions)

### Questions and practice

- [Class 12 IP MCQ test](/cbse-class-12-informatics-practices-mcq-test)
- [Class 12 IP SQL questions](/cbse-class-12-informatics-practices-sql-questions)

### Chapter by chapter

- [Pandas Series Class 12 IP](/cbse-class-12-informatics-practices-pandas-series)
- [Matplotlib and charts Class 12 IP](/cbse-class-12-informatics-practices-matplotlib-charts)
- [Computer networks Class 12 IP](/cbse-class-12-informatics-practices-computer-networks)
- [Societal impacts Class 12 IP](/cbse-class-12-informatics-practices-societal-impacts)

### Revision and help

- [Class 12 IP crash course](/cbse-class-12-informatics-practices-crash-course)

**CBSE Class 12 Computer Science (083):** [Class 12 CS viva questions](/cbse-class-12-computer-science-viva-questions)  [Class 12 CS sample paper practice](/cbse-class-12-computer-science-sample-paper-2026-27)  [Class 12 CS project with source code](/cbse-class-12-computer-science-project-python-mysql)  [Class 12 CS important questions](/cbse-class-12-computer-science-important-questions)

**CBSE Class 12 Information Technology (802):** [IT 802 practical and project file](/cbse-class-12-it-802-practical-and-project-file)  [IT 802 Java notes and programs](/cbse-class-12-it-802-java-programs)  [IT 802 notes](/cbse-class-12-it-802-notes)

**CBSE Class 11 CS, IP and AI:** [Class 11 CS practical file](/cbse-class-11-computer-science-practical-file)  [Class 11 IP practical file](/cbse-class-11-informatics-practices-practical-file)  [CS or IP in Class 11](/computer-science-or-informatics-practices-class-11)

**ISC Computer Science (868):** [ISC Class 12 CS syllabus 2027](/isc-class-12-computer-science-syllabus-2027)  [ISC Class 12 CS practice paper](/isc-class-12-computer-science-specimen-paper-practice)  [ISC Class 12 practical questions solved](/isc-class-12-computer-science-practical-questions)  [ISC Boolean algebra and K-maps](/isc-class-12-computer-science-boolean-algebra)

**Program lists with output:** [Class 12 practical file programs](/blog/python-practical-file-class-12)  [Python programs for Class 11 CS and IP](/blog/python-programs-for-class-11)

Questions about DataFrames

## DataFrame Class 12 IP: answers to common doubts

### What is a DataFrame in Class 12 IP?

A DataFrame is a two-dimensional labelled data structure in the pandas library, similar to a table or a sheet. It has an index for rows and labels for columns. Each column is a Series and can have its own data type. In CBSE 065 it belongs to Unit 1, which carries 25 theory marks with data visualization.

### In how many ways can a DataFrame be created in the 065 syllabus?

The syllabus lists three sources: a dictionary of Series, a list of dictionaries, and text or CSV files. In the first, each Series becomes a column. In the second, each dictionary becomes a row and its keys become column names. In the third, read_csv() builds the table from the file.

### What is the difference between loc and iloc?

loc selects by label and includes the last label of a slice. iloc selects by integer position, counted from 0, and excludes the stop position. cycles.loc["C2":"C4"] and cycles.iloc[1:4] both give three rows. A missing label is a KeyError with loc and a position out of range is an IndexError with iloc.

### What does axis=0 and axis=1 mean in drop()?

axis=0 means the label is a row label, and it is the default. axis=1 means the label is a column name. So df.drop("Maths", axis=1) deletes a column, while df.drop("Maths") looks for a row called Maths and raises KeyError. You may also write df.drop(columns=["Maths"]).

### What is inplace=True in pandas?

It tells pandas to change the DataFrame itself. Without it, drop() and rename() return a new DataFrame and leave the old one alone. The other correct way is to store the result, as in df = df.drop("Maths", axis=1). Do not do both, because the in-place version returns None.

### How do you add a new row to a DataFrame?

Use loc with a new label and a list of values, one for each column in order: df.loc[3] = ["Om", 12, 9]. If the label already exists, the row is replaced. The method append() is found in older notes and no longer exists in pandas 2.

### What is Boolean indexing in a DataFrame?

It is selection by a condition. An expression such as df["Age"] == 17 gives True or False for each row, and df[df["Age"] == 17] keeps the rows that are True. To use two conditions, put each in round brackets and join them with the ampersand sign for and, or the vertical bar for or.

### Why do I get an Unnamed: 0 column after read_csv()?

The file was saved with its row labels, which have no heading, so read_csv() gives that column the name Unnamed: 0. Save with to_csv("file.csv", index=False), or read with index_col=0 if you want those labels back.

### What is the difference between iterrows() and items()?

iterrows() goes through the rows and gives the row label and the row as a Series each time. items() goes through the columns and gives the column name and the column as a Series. Older books call the second one iteritems(), which pandas 2 removed.

### How many marks does DataFrame carry in the Class 12 IP sample paper?

In the 2026-27 sample paper, Questions 15, 18 and 20 are one mark each, 22 and 28 are two marks each, and 36 is five marks, which makes 12. Question 30 has a three-mark DataFrame option. CBSE fixes 25 marks for the unit, not for DataFrame alone.

### Do I need groupby and sorting for the theory paper?

The theory list for DataFrames does not name them. Grouping by category appears in the suggested practical list, so practise it for the lab and the file. In the theory paper, put your time into creation, selection, adding, renaming, deleting, Boolean indexing and CSV.

### Are one to one DataFrame classes available in the evening?

Yes, you pick the day and the hour. Modern Age Coders teaches live and personalised one to one, with a monthly fee and no admission charge. You can begin with a priority demo, a paid full class followed by a written skill report, whose fee counts towards the first month, or with a free demo class.

Start

## Bring any table, even a messy one

A page from your class register or a photo of a textbook exercise is enough for the free demo class. You type it in, and we ask it three questions together.

Want to see a complete lesson before you decide? Reserve a **priority demo** for an hour you like. You build a table, change it, filter it and save it, the teacher marks one long answer, and a skill report reaches you in writing. On enrolment the demo fee is adjusted against month one.

Short of time before the paper? See the [Class 12 IP crash course](/cbse-class-12-informatics-practices-crash-course).

[WhatsApp us](https://wa.me/919123366161?text=Hello%20Modern%20Age%20Coders.%20I%20want%20one%20to%20one%20classes%20on%20pandas%20DataFrame%20for%20CBSE%20Class%2012%20Informatics%20Practices%20065.) · [+91 91233 66161](tel:+919123366161) · [connect@modernagecoders.com](mailto:connect@modernagecoders.com)

Every class is live video. The form requests a callback and reserves nothing.

### Want it sooner? Book a priority demo

A full live class of about 45 to 60 minutes at a slot you pick, with a written skill report and learning roadmap on WhatsApp afterwards. The fee is adjusted against your first month if you enrol.

[Book a priority demo](/book-demo)

## Keep exploring Modern Age Coders

### By class and age

- [Class 12 Computer Science Syllabus 2026-27 (083) Explained](/cbse-class-12-computer-science-syllabus-2026-27)
- [Stack Class 12 Computer Science: Push, Pop and Questions](/cbse-class-12-computer-science-stack)
- [Class 12 Computer Science SQL Questions with Output (083)](/cbse-class-12-computer-science-sql-queries)
- [Class 12 Computer Science Revision Plan to 31 March 2027](/cbse-class-12-computer-science-revision-plan)
- [Python MySQL Connectivity Class 12: Programs and Errors](/cbse-class-12-computer-science-python-mysql-connectivity)
- [Class 12 Computer Science Project Topics: Python and SQL](/cbse-class-12-computer-science-project-topics)
- [Coding for Class 12: Board CS, College-Ready Portfolio](/coding-for-class-12)
- [Class 12 IP Syllabus 2026-27, Paper Pattern and Exam Date](/cbse-class-12-informatics-practices-syllabus-and-paper-pattern)
- [BC ADST Curriculum: Coding by Grade, Kindergarten to Grade 9](/bc-adst-curriculum-coding-by-grade)

### Free resources

- [C++ Tutorial: From Basics to Advanced](/resources/cpp)
- [Competitive Programming Patterns in C++](/resources/cpp/competitive-programming-patterns)
- [Ensemble Methods](/resources/ai-and-machine-learning/ensemble-methods-and-boosting)
- [Input, Output, and Formatting](/resources/cpp/input-output-and-formatting)

### From the blog

- [20 Python Programs for CBSE Class 12 Board Exam (083)](/blog/python-programs-for-cbse-class-12)
- [String Handling in Java: The ICSE and CBSE Guide](/blog/string-handling-in-java)
- [ICSE Class 10 Computer Applications: Revision Guide](/blog/icse-class-10-computer-applications-revision)

### Start here

- [Modern Age Coders pricing, one honest price per plan](/pricing)
- [How Modern Age Coders teaches, small batches and real projects](/how-we-teach)

---

*Canonical: https://learn.modernagecoders.com/cbse-class-12-informatics-practices-dataframe*
