Skip to content
Question 50 of 53

Q.State whether the following statement is True or False: In Python, we cannot create an empty DataFrame.

Puducherry TnboardCBSE Class XII Board 2025Subjective· 1mImportance★★★★★
94% · 50/53 Questions
🔒 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 →

Python's pandas library allows you to create an empty DataFrame with no rows or columns using pd.DataFrame(). The statement is False.

Why DataFrames can be empty

A DataFrame in pandas is a two-dimensional labeled data structure, essentially a table with rows and columns. Like any container in programming, it doesn't need to start with content. You can initialize an empty DataFrame and populate it later as data becomes available—this is common when building up results iteratively or when you need a structure ready before data arrives.

The flexibility to create empty DataFrames is actually quite useful in practice. You might start with an empty frame and add columns one by one, or append rows as you process data in a loop.

Creating an empty DataFrame

Here are the standard ways to create an empty DataFrame in pandas:

  1. Completely empty (no rows, no columns):

    import pandas as pd
    df = pd.DataFrame()
    

    This gives you a DataFrame with shape (0, 0).

  2. Empty with predefined columns:

    df = pd.DataFrame(columns=['Name', 'Age', 'City'])
    

    This creates a DataFrame with three columns but zero rows—shape (0, 3). The structure is ready; you just need to add data.

  3. Empty with a specific index:

    df = pd.DataFrame(index=range(5))
    ``` …
    

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.