Create a New Column:
Create a new column 'Comfortable' in the original DataFrame (df).
If the temperature is greater than or equal to 25 degrees Celsius and the rainfall is less than 50mm, set 'Comfortable' to 'Yes', otherwise 'No'.
Summary:
Provide a summary of the average temperature and total rainfall for each city over the entire dataset.
Sample data to create data frame:
data = {'City': ['City_A', 'City_A', 'City_B', 'City_B', 'City_C', 'City_C'],
'Month': ['January', 'February', 'January', 'February', 'January', 'February'],
'Temperature': [20, 25, 22, 28, 18, 23],
'Rainfall': [30, 40, 20, 50, 10, 30]}
Do'stlaringiz bilan baham: |