Skip to content
Activities · Activity 2.1

Q.Create a series having names of any five famous monuments of India and assign their States as index values.

West Bengal WbchseTextbookSubjective· 2mImportance★★★★★
3% · 1/38 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 →

Create a Pandas Series with five Indian monuments as values and their respective states as the index.

A Pandas Series is a one-dimensional labeled array. It holds data values (in this case, monument names) and associates each with an index label (here, the state where the monument is located). This structure is perfect when you want to map one piece of information to another — think of it as a dictionary with extra analytical power.

The Series constructor accepts data as a list, array, or dictionary, and an optional index parameter. When you pass a dictionary, the keys automatically become the index and the values become the data. That's the cleanest approach here.

import pandas as pd

# Create the Series with monuments as values and states as index
monuments = pd.Series(
    data=['Taj Mahal', 'Gateway of India', 'Hawa Mahal', 'Victoria Memorial', 'Charminar'],
    index=['Uttar Pradesh', 'Maharashtra', 'Rajasthan', 'West Bengal', 'Telangana']
)

print(monuments)

Output:

Uttar Pradesh      Taj Mahal
Maharashtra        Gateway of India
Rajasthan          Hawa Mahal
West Bengal        Victoria Memorial
Telangana          Charminar
dtype: object

The data parameter holds the monument names — these are the actual values stored in the Series. The index parameter holds the state names, which label each monument. When you print the Series, Pandas displays it in two columns: the index on the left, the values on the right, and the data type (object for strings) at the bottom.

Alternatively, you can use a dictionary directly:

import pandas as pd

monuments = pd.Series({
    'Uttar Pradesh': 'Taj Mahal',
    'Maharashtra': 'Gateway of India',
    'Rajasthan': 'Hawa Mahal', …

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.