मराठी

Create the following series and do the specified operation: MonthDays, from a numpy array having the number of days in the 12 months of a year. The labels should be the month numbers from 1 to 12.

Advertisements
Advertisements

प्रश्न

Create the following series and do the specified operation:

MonthDays, from a numpy array having the number of days in the 12 months of a year. The labels should be the month numbers from 1 to 12.

कोड लेखन
Advertisements

उत्तर

import pandas as pd
import numpy as np
MonthDays = pd.Series(np.array([31,28,31,30,31,30,31,31,30,31,30,31]), 
                      index=range(1,13))
print(MonthDays)

Output:

1 31
2 28
3 31
4 30
5 31
6 30
7 31
8 31
9 30
10 31
11 30
12 31
dtype int64
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 2: Data Handling using Pandas - I - Exercise [पृष्ठ ६०]

APPEARS IN

एनसीईआरटी Informatics Practices [English] Class 12
पाठ 2 Data Handling using Pandas - I
Exercise | Q 5. e) | पृष्ठ ६०
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×