PANDAS SERIES – DIFFERENCE-BASED QUESTIONS (Class XII)
✍️ VERY SHORT / SHORT ANSWER (2–3 MARKS)
Q1. Difference between Pandas Series and Python List
| Feature | Pandas Series | Python List |
|---|---|---|
| Indexing | Labeled index | No label, only position-based |
| Data type | Can store heterogeneous but usually single dtype | Can store heterogeneous |
| Operations | Supports vectorized operations | Requires loops for element-wise operations |
| Missing values | Can handle NaN | Cannot handle NaN directly |
| Methods | Built-in statistical & data analysis functions | Very limited functions |
Q2. Difference between loc[] and iloc[]
| Feature | loc[] | iloc[] |
|---|---|---|
| Indexing | Label-based | Integer position-based |
| Slicing | Includes last element | Excludes last element |
| Example | s.loc['a'] | s.iloc[0] |
Q3. Difference between size and count()
| Feature | size | count() |
|---|---|---|
| Counts | Total number of elements | Only non-NaN elements |
| Ignores NaN | No | Yes |
| Example | s.size → 5 | s.count() → 4 |
Q4. Difference between fillna() and dropna()
| Feature | fillna() | dropna() |
|---|---|---|
| Purpose | Replace missing values | Remove missing values |
| Modifies data | Yes | Yes |
| Example | s.fillna(0) | s.dropna() |
Q5. Difference between unique() and value_counts()
| Feature | unique() | value_counts() |
|---|---|---|
| Purpose | Returns unique values | Returns frequency of each value |
| Output type | Array | Series |
| Example | [10,20,30] | 10:2, 20:3 |
Q6. Difference between head() and tail()
| Feature | head() | tail() |
|---|---|---|
| Purpose | Returns first n elements | Returns last n elements |
| Default n | 5 | 5 |
| Example | s.head(3) | s.tail(3) |
Q7. Difference between Pandas Series and DataFrame
| Feature | Series | DataFrame |
|---|---|---|
| Dimension | 1-D | 2-D |
| Index | Single index | Row and column index |
| Data type | Usually single dtype | Can have multiple dtypes |
| Operations | Element-wise | Row-wise & column-wise |
Q8. Difference between s.index and s.values
Feature s.indexs.valuesPurpose Returns index labels Returns data values Type Index object NumPy array Example s.index → ['a','b','c'] s.values → [10,20,30]
| Feature | s.index | s.values |
|---|---|---|
| Purpose | Returns index labels | Returns data values |
| Type | Index object | NumPy array |
| Example | s.index → ['a','b','c'] | s.values → [10,20,30] |
Q9. Difference between isnull() and notnull()
Feature isnull()notnull()Purpose Checks for missing values Checks for non-missing values Output Boolean Series Boolean Series Example [True, False] [False, True]
Q10. Difference between Pandas Series and DataFrame
Feature Pandas Series Pandas DataFrame Dimension One-dimensional (1-D) Two-dimensional (2-D) Data storage Stores a single column of data Stores multiple columns of data (tabular form) Index Single index Row and column index Data type Usually stores a single data type (homogeneous) Can store multiple data types (heterogeneous) Representation A single labeled array Table with rows and columns Operations Element-wise operations Can perform row-wise and column-wise operations Example pd.Series([10,20,30], index=['a','b','c'])pd.DataFrame({'Name':['A','B'],'Marks':[90,85]})
| Feature | isnull() | notnull() |
|---|---|---|
| Purpose | Checks for missing values | Checks for non-missing values |
| Output | Boolean Series | Boolean Series |
| Example | [True, False] | [False, True] |
Q10. Difference between Pandas Series and DataFrame
| Feature | Pandas Series | Pandas DataFrame |
|---|---|---|
| Dimension | One-dimensional (1-D) | Two-dimensional (2-D) |
| Data storage | Stores a single column of data | Stores multiple columns of data (tabular form) |
| Index | Single index | Row and column index |
| Data type | Usually stores a single data type (homogeneous) | Can store multiple data types (heterogeneous) |
| Representation | A single labeled array | Table with rows and columns |
| Operations | Element-wise operations | Can perform row-wise and column-wise operations |
| Example | pd.Series([10,20,30], index=['a','b','c']) | pd.DataFrame({'Name':['A','B'],'Marks':[90,85]}) |
.png)

