English

Create the following series and do the specified operation: Vowels, having 5 elements with index labels ‘a’, ‘e’, ‘i’, ‘o’ and ‘u’ and all the five values set to zero. Check if it is an empty series.

Advertisements
Advertisements

Question

Create the following series and do the specified operation:

Vowels, having 5 elements with index labels ‘a’, ‘e’, ‘i’, ‘o’ and ‘u’ and all the five values set to zero. Check if it is an empty series.

Code Writing
Advertisements

Solution

import pandas as pd
Vowels = pd.Series([0, 0, 0, 0, 0], index=['a', 'e', 'i', 'o', 'u'])
print(Vowels)
print(Vowels.empty)

Output:

a 0
e 0
i 0
o 0
u 0
dtype int64
shaalaa.com
  Is there an error in this question or solution?
Chapter 2: Data Handling using Pandas - I - Exercise [Page 60]

APPEARS IN

NCERT Informatics Practices [English] Class 12
Chapter 2 Data Handling using Pandas - I
Exercise | Q 5. b) | Page 60
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×