Should Xarray have a read_csv method?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
Is your feature request related to a problem?
Most users of Xarray/Pandas start with an IO call of some sort. In Xarray, our open_dataset(..., engine=engine) interface provides an extensible interface to more complex backends (NetCDF, Zarr, GRIB, etc.). For tabular data types, we have traditionally pointed users to Pandas. While this works for users that are comfortable with Pandas, it is an added hurdle to users getting started with Xarray.
Describe the solution you'd like
It should be easy and obvious how a user can get a CSV (or other tabular data) into Xarray. Ideally, we don't force the user to use a third part library.
Describe alternatives you've considered
I can think of three possible solutions:
- We expose a new function
read_csv, it may do something like this:
def read_csv(filepath_or_buffer, **kwargs):
df = pd.read_csv(filepath_or_buffer, **kwargs)
ds = xr.Dataset.from_dataframe(df)
return ds
- We develop a storage backend to support reading CSV-like data:
ds = open_dataset(filepath, engine='csv')
- We copy (1) as an example and put it in Xarray's documentation. Explicitly showing how you would use Pandas to produce a Dataset from a CSV.
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 by reading the existing open_dataset interface and the linked CSV and other Pandas-supported formats documentation, then compare the proposed read_csv, CSV backend, and documentation approaches. Done requires a maintainer-selected direction with defined scope for getting tabular data into an Xarray Dataset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100