pydata / pydata/xarray

`DataArray.interp` only works for numeric dtypes

Open
#10,409 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic-interpolation
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

What is your issue?

Dataset.interp was updated to allow non-numeric dtypes in #5008

However, DataArray.interp still has an outdated check for numeric dtypes, meaning that other dtypes (e.g. datetimes) result in a TypeError:
https://github.com/pydata/xarray/blob/f1a2c08f21a8237c082913fcad2d77469448cf4c/xarray/core/dataarray.py#L2357

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect xarray/core/dataarray.py at the linked line and compare the DataArray.interp dtype check with the Dataset.interp update from #5008. Verify that interpolation with non-numeric values such as datetimes no longer raises a TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.