Skip to content
Question

Q.(a) Write a Python program to create and display a Pandas Series as shown below : July 31 Aug 31 Sept 30 Oct 31 The index labels are the names of the months – July, Aug, Sept, Oct. The corresponding scalar values are the number of days in these respective months – 31, 31, 30, 31.

(OR)
(b) A CSV file named customer.csv contains records of customers. The first row of the file represents the header. Sample data from the file is shown below : Name, Age, City Rudra,17,Kolkata Divya,19,Dehradun Nabeel,22,Lucknow Write a Python program to import data from the CSV file into a Pandas DataFrame named DF and display the last two rows.
CBSECBSE Class XII Board 2026Subjective· 3mImportance★★★★★
🔒 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 →

Part (a): build a Series with pd.Series(days, index=months) mapping July/Aug/Sept/Oct to 31/31/30/31.

Part (b): pd.read_csv('customer.csv') loads the file into DF; DF.tail(2) shows the last two rows.

Part (a)

A Series is a one-dimensional labelled array. Pass the values as the data and the month names via the index parameter.

import pandas as pd

months = ['July', 'Aug', 'Sept', 'Oct']
days   = [31, 31, 30, 31]
s = pd.Series(days, index=months)
print(s)

Expected output:

July     31
Aug      31
Sept     30
Oct      31
dtype: int64
``` …

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.