forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TST: split out some sparse tests (pandas-dev#18968)
- Loading branch information
Showing
17 changed files
with
302 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import pytest | ||
import numpy as np | ||
from pandas import SparseDataFrame, DataFrame, SparseSeries | ||
from pandas.util import testing as tm | ||
|
||
|
||
@pytest.mark.xfail(reason='Wrong SparseBlock initialization ' | ||
'(GH 17386)') | ||
def test_quantile(): | ||
# GH 17386 | ||
data = [[1, 1], [2, 10], [3, 100], [np.nan, np.nan]] | ||
q = 0.1 | ||
|
||
sparse_df = SparseDataFrame(data) | ||
result = sparse_df.quantile(q) | ||
|
||
dense_df = DataFrame(data) | ||
dense_expected = dense_df.quantile(q) | ||
sparse_expected = SparseSeries(dense_expected) | ||
|
||
tm.assert_series_equal(result, dense_expected) | ||
tm.assert_sp_series_equal(result, sparse_expected) | ||
|
||
|
||
@pytest.mark.xfail(reason='Wrong SparseBlock initialization ' | ||
'(GH 17386)') | ||
def test_quantile_multi(): | ||
# GH 17386 | ||
data = [[1, 1], [2, 10], [3, 100], [np.nan, np.nan]] | ||
q = [0.1, 0.5] | ||
|
||
sparse_df = SparseDataFrame(data) | ||
result = sparse_df.quantile(q) | ||
|
||
dense_df = DataFrame(data) | ||
dense_expected = dense_df.quantile(q) | ||
sparse_expected = SparseDataFrame(dense_expected) | ||
|
||
tm.assert_frame_equal(result, dense_expected) | ||
tm.assert_sp_frame_equal(result, sparse_expected) |
Oops, something went wrong.