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
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
