Skip to content
Open
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
4 changes: 3 additions & 1 deletion modin/pandas/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,9 @@ def cov(
if min_periods is not None and min_periods > len(cov_df):
result = np.empty((cov_df.shape[1], cov_df.shape[1]))
result.fill(np.nan)
return cov_df.__constructor__(result)
return cov_df.__constructor__(
result, index=cov_df.columns, columns=cov_df.columns
)

return cov_df.__constructor__(
query_compiler=cov_df._query_compiler.cov(
Expand Down
7 changes: 7 additions & 0 deletions modin/tests/pandas/dataframe/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,13 @@ def test_cov(min_periods, ddof, backend):
)


def test_cov_min_periods_greater_than_length():
eval_general(
*create_test_dfs({"a": [1, 2, 3], "b": [3, 2, 5]}),
lambda df: df.cov(min_periods=4),
)


@pytest.mark.parametrize("numeric_only", [True, False])
def test_cov_numeric_only(numeric_only):
if not numeric_only:
Expand Down