/usr/local/lib64/python3.6/site-packages/pandas/tests/series/methods
NameSizeModeActions
__pycache__/-0755rm
test_align.py53590644editdlrm
test_append.py96000644editdlrm
test_argsort.py22490644editdlrm
test_asfreq.py36160644editdlrm
test_asof.py55150644editdlrm
test_astype.py26280644editdlrm
test_at_time.py26290644editdlrm
test_autocorr.py9990644editdlrm
test_between.py11970644editdlrm
test_between_time.py50860644editdlrm
test_clip.py33840644editdlrm
test_combine.py6270644editdlrm
test_combine_first.py34110644editdlrm
test_compare.py37340644editdlrm
test_convert_dtypes.py99140644editdlrm
test_count.py11230644editdlrm
test_cov_corr.py52150644editdlrm
test_describe.py46400644editdlrm
test_diff.py23310644editdlrm
test_drop.py29860644editdlrm
test_droplevel.py6290644editdlrm
test_drop_duplicates.py68500644editdlrm
test_duplicated.py9960644editdlrm
test_equals.py12950644editdlrm
test_explode.py35380644editdlrm
test_fillna.py65130644editdlrm
test_first_and_last.py20420644editdlrm
test_head_tail.py3430644editdlrm
test_interpolate.py277570644editdlrm
test_isin.py34450644editdlrm
test_nlargest.py71210644editdlrm
test_pct_change.py29680644editdlrm
test_quantile.py68100644editdlrm
test_rank.py202870644editdlrm
test_reindex_like.py12450644editdlrm
test_rename.py33780644editdlrm
test_rename_axis.py15030644editdlrm
test_replace.py155590644editdlrm
test_reset_index.py46360644editdlrm
test_round.py19700644editdlrm
test_searchsorted.py21210644editdlrm
test_shift.py125950644editdlrm
test_sort_index.py122770644editdlrm
test_sort_values.py79810644editdlrm
test_to_dict.py7420644editdlrm
test_to_period.py17550644editdlrm
test_to_timestamp.py26160644editdlrm
test_truncate.py55570644editdlrm
test_tz_convert.py10080644editdlrm
test_tz_localize.py31080644editdlrm
test_unstack.py42080644editdlrm
test_update.py42130644editdlrm
test_value_counts.py81360644editdlrm
__init__.py2250644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/pandas/tests/series/methods/test_compare.py (3734B)
import numpy as np import pytest import pandas as pd import pandas._testing as tm @pytest.mark.parametrize("align_axis", [0, 1, "index", "columns"]) def test_compare_axis(align_axis): # GH#30429 s1 = pd.Series(["a", "b", "c"]) s2 = pd.Series(["x", "b", "z"]) result = s1.compare(s2, align_axis=align_axis) if align_axis in (1, "columns"): indices = pd.Index([0, 2]) columns = pd.Index(["self", "other"]) expected = pd.DataFrame( [["a", "x"], ["c", "z"]], index=indices, columns=columns ) tm.assert_frame_equal(result, expected) else: indices = pd.MultiIndex.from_product([[0, 2], ["self", "other"]]) expected = pd.Series(["a", "x", "c", "z"], index=indices) tm.assert_series_equal(result, expected) @pytest.mark.parametrize( "keep_shape, keep_equal", [ (True, False), (False, True), (True, True), # False, False case is already covered in test_compare_axis ], ) def test_compare_various_formats(keep_shape, keep_equal): s1 = pd.Series(["a", "b", "c"]) s2 = pd.Series(["x", "b", "z"]) result = s1.compare(s2, keep_shape=keep_shape, keep_equal=keep_equal) if keep_shape: indices = pd.Index([0, 1, 2]) columns = pd.Index(["self", "other"]) if keep_equal: expected = pd.DataFrame( [["a", "x"], ["b", "b"], ["c", "z"]], index=indices, columns=columns ) else: expected = pd.DataFrame( [["a", "x"], [np.nan, np.nan], ["c", "z"]], index=indices, columns=columns, ) else: indices = pd.Index([0, 2]) columns = pd.Index(["self", "other"]) expected = pd.DataFrame( [["a", "x"], ["c", "z"]], index=indices, columns=columns ) tm.assert_frame_equal(result, expected) def test_compare_with_equal_nulls(): # We want to make sure two NaNs are considered the same # and dropped where applicable s1 = pd.Series(["a", "b", np.nan]) s2 = pd.Series(["x", "b", np.nan]) result = s1.compare(s2) expected = pd.DataFrame([["a", "x"]], columns=["self", "other"]) tm.assert_frame_equal(result, expected) def test_compare_with_non_equal_nulls(): # We want to make sure the relevant NaNs do not get dropped s1 = pd.Series(["a", "b", "c"]) s2 = pd.Series(["x", "b", np.nan]) result = s1.compare(s2, align_axis=0) indices = pd.MultiIndex.from_product([[0, 2], ["self", "other"]]) expected = pd.Series(["a", "x", "c", np.nan], index=indices) tm.assert_series_equal(result, expected) def test_compare_multi_index(): index = pd.MultiIndex.from_arrays([[0, 0, 1], [0, 1, 2]]) s1 = pd.Series(["a", "b", "c"], index=index) s2 = pd.Series(["x", "b", "z"], index=index) result = s1.compare(s2, align_axis=0) indices = pd.MultiIndex.from_arrays( [[0, 0, 1, 1], [0, 0, 2, 2], ["self", "other", "self", "other"]] ) expected = pd.Series(["a", "x", "c", "z"], index=indices) tm.assert_series_equal(result, expected) def test_compare_unaligned_objects(): # test Series with different indices msg = "Can only compare identically-labeled Series objects" with pytest.raises(ValueError, match=msg): ser1 = pd.Series([1, 2, 3], index=["a", "b", "c"]) ser2 = pd.Series([1, 2, 3], index=["a", "b", "d"]) ser1.compare(ser2) # test Series with different lengths msg = "Can only compare identically-labeled Series objects" with pytest.raises(ValueError, match=msg): ser1 = pd.Series([1, 2, 3]) ser2 = pd.Series([1, 2, 3, 4]) ser1.compare(ser2)