From 7b671db85d344fd6e0ca2d2a25a862d84118988c Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sun, 2 Jun 2024 22:00:02 +0100 Subject: [PATCH] test: update tests, examples using deprecated `pandas` parameters --- tests/examples_arguments_syntax/bump_chart.py | 2 +- tests/examples_methods_syntax/bump_chart.py | 2 +- tests/utils/test_utils.py | 8 ++++---- tests/vegalite/v5/test_api.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/examples_arguments_syntax/bump_chart.py b/tests/examples_arguments_syntax/bump_chart.py index 1586b956e..102784590 100644 --- a/tests/examples_arguments_syntax/bump_chart.py +++ b/tests/examples_arguments_syntax/bump_chart.py @@ -12,7 +12,7 @@ import pandas as pd stocks = data.stocks() -source = stocks.groupby([pd.Grouper(key="date", freq="6M"),"symbol"]).mean().reset_index() +source = stocks.groupby([pd.Grouper(key="date", freq="6ME"),"symbol"]).mean().reset_index() alt.Chart(source).mark_line(point = True).encode( x = alt.X("date:O", timeUnit="yearmonth", title="date"), diff --git a/tests/examples_methods_syntax/bump_chart.py b/tests/examples_methods_syntax/bump_chart.py index 03f88c8ac..0c31b06e7 100644 --- a/tests/examples_methods_syntax/bump_chart.py +++ b/tests/examples_methods_syntax/bump_chart.py @@ -12,7 +12,7 @@ import pandas as pd stocks = data.stocks() -source = stocks.groupby([pd.Grouper(key="date", freq="6M"),"symbol"]).mean().reset_index() +source = stocks.groupby([pd.Grouper(key="date", freq="6ME"),"symbol"]).mean().reset_index() alt.Chart(source).mark_line(point=True).encode( x=alt.X("date:O").timeUnit("yearmonth").title("date"), diff --git a/tests/utils/test_utils.py b/tests/utils/test_utils.py index aa49e9369..425d2297d 100644 --- a/tests/utils/test_utils.py +++ b/tests/utils/test_utils.py @@ -46,11 +46,11 @@ def test_sanitize_dataframe(): "f": np.arange(5, dtype=float), "i": np.arange(5, dtype=int), "b": np.array([True, False, True, True, False]), - "d": pd.date_range("2012-01-01", periods=5, freq="H"), + "d": pd.date_range("2012-01-01", periods=5, freq="h"), "c": pd.Series(list("ababc"), dtype="category"), "c2": pd.Series([1, "A", 2.5, "B", None], dtype="category"), "o": pd.Series([np.array(i) for i in range(5)]), - "p": pd.date_range("2012-01-01", periods=5, freq="H").tz_localize("UTC"), + "p": pd.date_range("2012-01-01", periods=5, freq="h").tz_localize("UTC"), } ) @@ -98,9 +98,9 @@ def test_sanitize_dataframe_arrow_columns(): "f": np.arange(5, dtype=float), "i": np.arange(5, dtype=int), "b": np.array([True, False, True, True, False]), - "d": pd.date_range("2012-01-01", periods=5, freq="H"), + "d": pd.date_range("2012-01-01", periods=5, freq="h"), "c": pd.Series(list("ababc"), dtype="category"), - "p": pd.date_range("2012-01-01", periods=5, freq="H").tz_localize("UTC"), + "p": pd.date_range("2012-01-01", periods=5, freq="h").tz_localize("UTC"), } ) df_arrow = pa.Table.from_pandas(df).to_pandas(types_mapper=pd.ArrowDtype) diff --git a/tests/vegalite/v5/test_api.py b/tests/vegalite/v5/test_api.py index 01bd94674..31aa825c7 100644 --- a/tests/vegalite/v5/test_api.py +++ b/tests/vegalite/v5/test_api.py @@ -115,7 +115,7 @@ def Chart(data): def test_chart_infer_types(): data = pd.DataFrame( { - "x": pd.date_range("2012", periods=10, freq="Y"), + "x": pd.date_range("2012", periods=10, freq="YE"), "y": range(10), "c": list("abcabcabca"), "s": pd.Categorical([1, 2] * 5, categories=[2, 1], ordered=True), @@ -220,7 +220,7 @@ def test_multiple_encodings(args, kwargs): def test_chart_operations(): data = pd.DataFrame( { - "x": pd.date_range("2012", periods=10, freq="Y"), + "x": pd.date_range("2012", periods=10, freq="YE"), "y": range(10), "c": list("abcabcabca"), }