I have the following problem: I'm researching some pollutants in the State of São Paulo, Brazil. I read the xarray data (.nc) and transformed it into DataFrame. For each coordinate (longitude, latitude) I have data for five years (from 01-01-2015 until 31-12-2019) Update As an example: df = pd.DataFrame({'date': ['01-01-2015 00:00:00', '01-01-2015 03:00:00', '02-01-2015 00:00:00', '02-01-2015 03:00:00', '10-01-2015 00:00:00'], 'latitude': [-55.0, -55.0, -52.0, -52.0, -43.0], 'longitude': [-18.5, -18.5, -21.5, -21.5, -26.0], 'PM': [10, 20, 20, 30, 35]}) For the coordinate, (-55, -18.5), PM mean value has to be 15 (10+20/2). For the coordinate, (-52, -21.5), PM mean value has to be 25 (20+30/2). For the coordinate, (-43, -26), PM mean value has to be 55 (35/1). I want to obtain just the mean values for PM column, and to do that, I have to use the date and maintain the coordinates as they are. How can I group the dates to use the mean method, and maintain the coordinates intact? Continue reading...