harbor run -t openthoughts/tasktrove-exp-rpt-issue-issue-1217harbor download openthoughts/tasktrove-exp-rpt-issue-issue-1217('x', 'y') being stored with dtype object instead of a string dtype such as <U1 or similar.Files to modify (before/expected state as provided in this task):
# app/xarray/core/alignment.py (before)
from . import dtypes, utils
from .indexing import get_indexer_nd
from .utils import is_dict_like, is_full_slice
from .variable import IndexVariable, Variable
def align(objects, dim=None, exclude=None, join='outer'):
# ...
all_indexes = defaultdict(list)
unlabeled_dim_sizes = defaultdict(set)
for obj in objects:
for dim in obj.dims:
if dim not in exclude:
all_coords[dim].append(obj.coords[dim])
try:
index = obj.indexes[dim]
except KeyError:
# some path
pass
else:
if some_condition:
joined_indexes[dim] = index
else:
if join == "exact":
raise ValueError(...)
index = matching_indexes[0]
joined_indexes[dim] = index
# app/xarray/core/utils.py (before)
import numpy as np
import pandas as pd
def maybe_cast_to_coords_dtype(label, coords_dtype):
return label
def safe_cast_to_index(array: Any) -> pd.Index:
"""Given an array, safely cast it to a pandas.Index.
(existing implementation)
"""
# ...
# app/xarray/core/merge.py (before)
def dataset_update_method(dataset, other, ...):
# ...
# use ds.indexes, which can lead to string coords being cast to object
return merge_core(
[dataset, other],
priority_arg=1,
indexes=dataset.indexes,
combine_attrs="override",
)
# app/xarray/core/dataset.py (before)
def reindex(ds, ...) -> Dataset:
# ...
ds = Dataset(...)
# Coordinates:
# * station (station) object 'boston' 'austin' 'seattle' 'lincoln'
Notes