shift time using frequency strings
Open
Nobody has claimed this yet.
API design
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
Discussed in https://github.com/pydata/xarray/discussions/7557
Originally posted by arfriedman February 24, 2023
Hi,
In addition to integer offsets, I was wondering if it is possible to shift a variable by a specific time frequency interval as in pandas.
For example, something like:
import xarray as xr
ds = xr.tutorial.load_dataset("air_temperature")
air = ds["air"]
air.shift(time="1D")
Otherwise, is there another xarray function or recommended approach for this type of operation?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with xarray.Variable.shift and compare its integer-offset behavior with pandas.Series.shift. Reproduce the air_temperature example using air.shift(time="1D"); clarify the desired frequency-string semantics and document or implement the recommended behavior, with coverage for the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100