Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PeriodIndex deprecation in xarray tests #8182

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def setup(self, dtype, subset):
[
list("abcdefhijk"),
list("abcdefhijk"),
pd.date_range(start="2000-01-01", periods=1000, freq="B"),
pd.date_range(start="2000-01-01", periods=1000, freq="D"),
]
)
series = pd.Series(data, index)
Expand Down
2 changes: 1 addition & 1 deletion xarray/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def test_repr_multiindex(self) -> None:

def test_repr_period_index(self) -> None:
data = create_test_data(seed=456)
data.coords["time"] = pd.period_range("2000-01-01", periods=20, freq="B")
data.coords["time"] = pd.period_range("2000-01-01", periods=20, freq="D")

# check that creating the repr doesn't raise an error #GH645
repr(data)
Expand Down
6 changes: 3 additions & 3 deletions xarray/tests/test_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,10 @@ def test_pandas_data(self):
assert v[0].values == v.values[0]

def test_pandas_period_index(self):
v = self.cls(["x"], pd.period_range(start="2000", periods=20, freq="B"))
v = self.cls(["x"], pd.period_range(start="2000", periods=20, freq="D"))
v = v.load() # for dask-based Variable
assert v[0] == pd.Period("2000", freq="B")
assert "Period('2000-01-03', 'B')" in repr(v)
assert v[0] == pd.Period("2000", freq="D")
assert "Period('2000-01-01', 'D')" in repr(v)

@pytest.mark.parametrize("dtype", [float, int])
def test_1d_math(self, dtype: np.typing.DTypeLike) -> None:
Expand Down
Loading