CBSE Class 12 Informatics Practices
Question 148 of 167
Python Pandas — I — Question 2
Back to all questions 2
Question Write Python code to create a Series object Temp2 storing temperatures of seven days of week. Its indexes should be 'Sunday', 'Monday',... 'Saturday'.
import pandas as pd
temperatures = [28.9, 30.1, 26.2, 29.3, 27.5, 31.9, 25.5]
days_of_week = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
Temp2 = pd.Series(temperatures, index = days_of_week)
print(Temp2)Sunday 28.9
Monday 30.1
Tuesday 26.2
Wednesday 29.3
Thursday 27.5
Friday 31.9
Saturday 25.5
dtype: float64