| 315 | return func(*args, **kwargs) |
| 316 | |
| 317 | def wrap_func(resampled, *args, **kwargs): |
| 318 | result = func(resampled, *args, **kwargs) |
| 319 | if not isinstance(result, pd.DataFrame) and not isinstance(result, pd.Series): |
| 320 | result = np.asarray(result) |
| 321 | if result.ndim == 1: |
| 322 | result = pd.Series(result, name=resampled.name) |
| 323 | elif result.ndim == 2: |
| 324 | result = pd.DataFrame(result.T) |
| 325 | # Resample back to data index |
| 326 | if not isinstance(result.index, pd.DatetimeIndex): |
| 327 | result.index = resampled.index |
| 328 | result = result.reindex(index=series.index.union(resampled.index), |
| 329 | method='ffill').reindex(series.index) |
| 330 | return result |
| 331 | |
| 332 | wrap_func.__name__ = func.__name__ |
| 333 | |