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

Add rolling cov #5154

Merged
merged 10 commits into from Aug 5, 2019

Add time series cov tests

  • Loading branch information...
ivarsfg committed Jul 26, 2019
commit a68d483fe227ad1ed9c4fb0a272e9d716bf0b66c
@@ -165,24 +165,20 @@ def test_rolling_methods(method, args, window, center, check_less_precise):
check_less_precise=check_less_precise,
)


@pytest.mark.parametrize("window", [1, 2, 4, 5])
@pytest.mark.parametrize("center", [True, False])
def test_rolling_cov(window, center):
# DataFrame
prolling = df.drop('a', 1).rolling(window, center=center)
drolling = ddf.drop('a', 1).rolling(window, center=center)
assert_eq(
getattr(prolling, 'cov')(),
getattr(drolling, 'cov')(),
)
prolling = df.drop("a", 1).rolling(window, center=center)
drolling = ddf.drop("a", 1).rolling(window, center=center)
assert_eq(getattr(prolling, "cov")(), getattr(drolling, "cov")())
This conversation was marked as resolved by ivarsfg

This comment has been minimized.

Copy link
@jcrist

jcrist Jul 26, 2019

Member

Since you're not parametrizing on the method anymore, you can just call cov directly:

Suggested change
assert_eq(getattr(prolling, "cov")(), getattr(drolling, "cov")())
assert_eq(prolling.cov(), drolling.cov())

# Series
prolling = df.b.rolling(window, center=center)
drolling = ddf.b.rolling(window, center=center)
assert_eq(
getattr(prolling, 'cov')(),
getattr(drolling, 'cov')(),
)
assert_eq(getattr(prolling, "cov")(), getattr(drolling, "cov")())
This conversation was marked as resolved by ivarsfg

This comment has been minimized.

Copy link
@jcrist

jcrist Jul 26, 2019

Member
Suggested change
assert_eq(getattr(prolling, "cov")(), getattr(drolling, "cov")())
assert_eq(prolling.cov(), drolling.cov())


@pytest.mark.skipif(PANDAS_VERSION >= "0.23.0", reason="Raw is allowed.")
def test_rolling_raw_pandas_lt_0230_raises():
@@ -291,6 +287,20 @@ def test_time_rolling_methods(method, args, window, check_less_precise):
)


@pytest.mark.parametrize("window", [1, 2, 4, 5])
@pytest.mark.parametrize("center", [True, False])
def test_time_rolling_cov(window, center):
# DataFrame
prolling = ts.drop("a", 1).rolling(window)
drolling = dts.drop("a", 1).rolling(window)
assert_eq(getattr(prolling, "cov")(), getattr(drolling, "cov")())
This conversation was marked as resolved by ivarsfg

This comment has been minimized.

Copy link
@jcrist

jcrist Jul 26, 2019

Member
Suggested change
assert_eq(getattr(prolling, "cov")(), getattr(drolling, "cov")())
assert_eq(prolling.cov(), drolling.cov())

# Series
prolling = ts.b.rolling(window, center=center)
drolling = dts.b.rolling(window, center=center)
assert_eq(getattr(prolling, "cov")(), getattr(drolling, "cov")())
This conversation was marked as resolved by ivarsfg

This comment has been minimized.

Copy link
@jcrist

jcrist Jul 26, 2019

Member
Suggested change
assert_eq(getattr(prolling, "cov")(), getattr(drolling, "cov")())
assert_eq(prolling.cov(), drolling.cov())


@pytest.mark.parametrize(
"window,N",
[("1s", 10), ("2s", 10), ("10s", 10), ("10h", 10), ("10s", 100), ("10h", 100)],
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.