I have a dataframe that contains data collected every 0.01m down into the earth. Due to its high resolution the resulting size of the dataset is very large. Is there a way in pandas to downsample to 5m intervals thus reducing the size of the dataset?
RESULT (Every 0.01m)
| Depth_m | value |
|---|---|
| 1.34 | 31.7 |
| 1.35 | 31.7 |
| 1.36 | 31.7 |
| 1.37 | 31.9 |
| 1.38 | 31.9 |
| 1.39 | 31.9 |
| 1.40 | 31.9 |
| .... | ..... |
| 44.35 | 32.9 |
| 44.36 | 32.9 |
| 44.37 | 32.9 |
OUTCOME I WANT (Every 5m)
| Depth_m | value |
|---|---|
| 5.47 | 31.7 |
| 10.49 | 31.7 |
| 15.51 | 31.7 |
| 20.53 | 31.9 |
| 25.55 | 31.9 |
| 30.57 | 31.9 |
| 35.59 | 31.9 |
| 40.61 | 31.9 |
| 45.63 | 31.9 |
I have tried to use pandas.resample but that seems to only work with timeseries data. I think I understand what I must do but not sure how to do it in pandas. Basically I am thinking I need to calculate what the current sampling rate is, in this case 0.01m. Then how many observations are there every 5m. Then I can average the values based on the number of observations and drop the rows. Loop through this process every 5m.