Skip to content
Question

Q.Which of the following is a two-dimensional labelled data structure of Python? (A) Relation (B) Data frame (C) Series (D) Square

CBSECBSE Class XII Board 2023MCQ· 1mImportance★★★★★
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

A DataFrame is the two-dimensional labelled data structure in Python's Pandas library, akin to a spreadsheet or a SQL table.

When working with data in Python, especially for analysis and manipulation, the Pandas library provides highly efficient and flexible data structures. These structures are designed to handle various types of data, making them indispensable tools. The question specifically asks for a two-dimensional labelled data structure. To understand this, we need to differentiate between the primary data structures offered by Pandas: Series and DataFrame.

A Series is a one-dimensional labelled array capable of holding any data type (integers, strings, floating point numbers, Python objects, etc.). Think of it like a single column in a spreadsheet or a list in Python, but with an added feature: each item in the Series has a unique label, called an index. This index allows for easy retrieval and manipulation of data based on these labels, rather than just numerical positions. For example, you might have a Series storing the marks of students, where each mark is associated with a student's roll number or name as its label. Because it's a single sequence of values, it is considered one-dimensional.

Note

The "labelled" aspect means that each piece of data isn't just at a numerical position (like list[0]), but can also be accessed by a custom label (like series['Roll_No_101']).

In contrast, a DataFrame is a two-dimensional labelled data structure with columns of potentially different types. It is essentially a table, much like a spreadsheet or a SQL database table. A DataFrame has both a labelled row index and labelled columns. This means you can access data by referring to both its row label and its column label. For instance, if you have a table of student data, you might have columns for 'Name', 'Roll Number', 'Marks', and 'Grade'. Each row would represent a different student, and each column would represent a different attribute. This tabular arrangement, with both rows and columns, makes it inherently two-dimensional. …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.