Skip to content

Commit b0a2667

Browse files
h-vetinariWillAyd
authored andcommitted
CLN: res/exp and GH references in frame tests (#22730)
1 parent 904af03 commit b0a2667

File tree

4 files changed

+111
-110
lines changed

4 files changed

+111
-110
lines changed

pandas/tests/frame/test_analytics.py

+32-32
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def test_corr_cov_independent_index_column(self):
340340
assert result.index.equals(result.columns)
341341

342342
def test_corr_invalid_method(self):
343-
# GH PR #22298
343+
# GH 22298
344344
df = pd.DataFrame(np.random.normal(size=(10, 2)))
345345
msg = ("method must be either 'pearson', 'spearman', "
346346
"or 'kendall'")
@@ -548,8 +548,8 @@ def test_describe_categorical(self):
548548

549549
cat = Series(Categorical(["a", "b", "c", "c"]))
550550
df3 = DataFrame({"cat": cat, "s": ["a", "b", "c", "c"]})
551-
res = df3.describe()
552-
tm.assert_numpy_array_equal(res["cat"].values, res["s"].values)
551+
result = df3.describe()
552+
tm.assert_numpy_array_equal(result["cat"].values, result["s"].values)
553553

554554
def test_describe_categorical_columns(self):
555555
# GH 11558
@@ -620,8 +620,8 @@ def test_describe_timedelta_values(self):
620620
index=['count', 'mean', 'std', 'min', '25%',
621621
'50%', '75%', 'max'])
622622

623-
res = df.describe()
624-
tm.assert_frame_equal(res, expected)
623+
result = df.describe()
624+
tm.assert_frame_equal(result, expected)
625625

626626
exp_repr = (" t1 t2\n"
627627
"count 5 5\n"
@@ -632,7 +632,7 @@ def test_describe_timedelta_values(self):
632632
"50% 3 days 00:00:00 0 days 03:00:00\n"
633633
"75% 4 days 00:00:00 0 days 04:00:00\n"
634634
"max 5 days 00:00:00 0 days 05:00:00")
635-
assert repr(res) == exp_repr
635+
assert repr(result) == exp_repr
636636

637637
def test_describe_tz_values(self, tz_naive_fixture):
638638
# GH 21332
@@ -653,8 +653,8 @@ def test_describe_tz_values(self, tz_naive_fixture):
653653
'last', 'mean', 'std', 'min', '25%', '50%',
654654
'75%', 'max']
655655
)
656-
res = df.describe(include='all')
657-
tm.assert_frame_equal(res, expected)
656+
result = df.describe(include='all')
657+
tm.assert_frame_equal(result, expected)
658658

659659
def test_reduce_mixed_frame(self):
660660
# GH 6806
@@ -684,7 +684,7 @@ def test_count(self, float_frame_with_na, float_frame, float_string_frame):
684684
ct2 = frame.count(0)
685685
assert isinstance(ct2, Series)
686686

687-
# GH #423
687+
# GH 423
688688
df = DataFrame(index=lrange(10))
689689
result = df.count(1)
690690
expected = Series(0, index=df.index)
@@ -731,7 +731,7 @@ def test_sum(self, float_frame_with_na, mixed_float_frame,
731731
@pytest.mark.parametrize('method', ['sum', 'mean', 'prod', 'var',
732732
'std', 'skew', 'min', 'max'])
733733
def test_stat_operators_attempt_obj_array(self, method):
734-
# GH #676
734+
# GH 676
735735
data = {
736736
'a': [-0.00049987540199591344, -0.0016467257772919831,
737737
0.00067695870775883013],
@@ -873,7 +873,7 @@ def test_var_std(self, float_frame_with_na, datetime_frame, float_frame,
873873
@pytest.mark.parametrize(
874874
"meth", ['sem', 'var', 'std'])
875875
def test_numeric_only_flag(self, meth):
876-
# GH #9201
876+
# GH 9201
877877
df1 = DataFrame(np.random.randn(5, 3), columns=['foo', 'bar', 'baz'])
878878
# set one entry to a number in str format
879879
df1.loc[0, 'foo'] = '100'
@@ -1438,12 +1438,12 @@ def test_any_all_extra(self):
14381438
(np.any, {'A': pd.Series([1, 2], dtype='category')}, True),
14391439
14401440
# # Mix
1441-
# GH-21484
1441+
# GH 21484
14421442
# (np.all, {'A': pd.Series([10, 20], dtype='M8[ns]'),
14431443
# 'B': pd.Series([10, 20], dtype='m8[ns]')}, True),
14441444
])
14451445
def test_any_all_np_func(self, func, data, expected):
1446-
# https://github.com/pandas-dev/pandas/issues/19976
1446+
# GH 19976
14471447
data = DataFrame(data)
14481448
result = func(data)
14491449
assert isinstance(result, np.bool_)
@@ -1455,7 +1455,7 @@ def test_any_all_np_func(self, func, data, expected):
14551455
assert result.item() is expected
14561456

14571457
def test_any_all_object(self):
1458-
# https://github.com/pandas-dev/pandas/issues/19976
1458+
# GH 19976
14591459
result = np.all(DataFrame(columns=['a', 'b'])).item()
14601460
assert result is True
14611461

@@ -1477,7 +1477,7 @@ def test_any_all_level_axis_none_raises(self, method):
14771477
# Isin
14781478

14791479
def test_isin(self):
1480-
# GH #4211
1480+
# GH 4211
14811481
df = DataFrame({'vals': [1, 2, 3, 4], 'ids': ['a', 'b', 'f', 'n'],
14821482
'ids2': ['a', 'n', 'c', 'n']},
14831483
index=['foo', 'bar', 'baz', 'qux'])
@@ -1489,7 +1489,7 @@ def test_isin(self):
14891489

14901490
@pytest.mark.parametrize("empty", [[], Series(), np.array([])])
14911491
def test_isin_empty(self, empty):
1492-
# see gh-16991
1492+
# GH 16991
14931493
df = DataFrame({'A': ['a', 'b', 'c'], 'B': ['a', 'e', 'f']})
14941494
expected = DataFrame(False, df.index, df.columns)
14951495

@@ -1515,7 +1515,7 @@ def test_isin_dict(self):
15151515
tm.assert_frame_equal(result, expected)
15161516

15171517
def test_isin_with_string_scalar(self):
1518-
# GH4763
1518+
# GH 4763
15191519
df = DataFrame({'vals': [1, 2, 3, 4], 'ids': ['a', 'b', 'f', 'n'],
15201520
'ids2': ['a', 'n', 'c', 'n']},
15211521
index=['foo', 'bar', 'baz', 'qux'])
@@ -1541,7 +1541,7 @@ def test_isin_df(self):
15411541
tm.assert_frame_equal(result, expected)
15421542

15431543
def test_isin_tuples(self):
1544-
# GH16394
1544+
# GH 16394
15451545
df = pd.DataFrame({'A': [1, 2, 3], 'B': ['a', 'b', 'f']})
15461546
df['C'] = list(zip(df['A'], df['B']))
15471547
result = df['C'].isin([(1, 'a')])
@@ -1751,7 +1751,7 @@ def test_round(self):
17511751
expected_rounded['col1'])
17521752

17531753
def test_numpy_round(self):
1754-
# See gh-12600
1754+
# GH 12600
17551755
df = DataFrame([[1.53, 1.36], [0.06, 7.01]])
17561756
out = np.round(df, decimals=0)
17571757
expected = DataFrame([[2., 1.], [0., 7.]])
@@ -1762,7 +1762,7 @@ def test_numpy_round(self):
17621762
np.round(df, decimals=0, out=df)
17631763

17641764
def test_round_mixed_type(self):
1765-
# GH11885
1765+
# GH 11885
17661766
df = DataFrame({'col1': [1.1, 2.2, 3.3, 4.4],
17671767
'col2': ['1', 'a', 'c', 'f'],
17681768
'col3': date_range('20111111', periods=4)})
@@ -1777,7 +1777,7 @@ def test_round_mixed_type(self):
17771777
tm.assert_frame_equal(df.round({'col3': 1}), df)
17781778

17791779
def test_round_issue(self):
1780-
# GH11611
1780+
# GH 11611
17811781

17821782
df = pd.DataFrame(np.random.random([3, 3]), columns=['A', 'B', 'C'],
17831783
index=['first', 'second', 'third'])
@@ -1794,7 +1794,7 @@ def test_built_in_round(self):
17941794
pytest.skip("build in round cannot be overridden "
17951795
"prior to Python 3")
17961796

1797-
# GH11763
1797+
# GH 11763
17981798
# Here's the test frame we'll be working with
17991799
df = DataFrame(
18001800
{'col1': [1.123, 2.123, 3.123], 'col2': [1.234, 2.234, 3.234]})
@@ -1838,7 +1838,7 @@ def test_clip(self, float_frame):
18381838
assert (float_frame.values == original.values).all()
18391839

18401840
def test_inplace_clip(self, float_frame):
1841-
# GH #15388
1841+
# GH 15388
18421842
median = float_frame.median().median()
18431843
frame_copy = float_frame.copy()
18441844

@@ -1854,7 +1854,7 @@ def test_inplace_clip(self, float_frame):
18541854
assert not (frame_copy.values != median).any()
18551855

18561856
def test_dataframe_clip(self):
1857-
# GH #2747
1857+
# GH 2747
18581858
df = DataFrame(np.random.randn(1000, 2))
18591859

18601860
for lb, ub in [(-1, 1), (1, -1)]:
@@ -1881,7 +1881,7 @@ def test_clip_mixed_numeric(self):
18811881

18821882
@pytest.mark.parametrize("inplace", [True, False])
18831883
def test_clip_against_series(self, inplace):
1884-
# GH #6966
1884+
# GH 6966
18851885

18861886
df = DataFrame(np.random.randn(1000, 2))
18871887
lb = Series(np.random.randn(1000))
@@ -1916,7 +1916,7 @@ def test_clip_against_series(self, inplace):
19161916
])
19171917
def test_clip_against_list_like(self, simple_frame,
19181918
inplace, lower, axis, res):
1919-
# GH #15390
1919+
# GH 15390
19201920
original = simple_frame.copy(deep=True)
19211921

19221922
result = original.clip(lower=lower, upper=[5, 6, 7],
@@ -1947,12 +1947,12 @@ def test_clip_against_frame(self, axis):
19471947

19481948
def test_clip_with_na_args(self, float_frame):
19491949
"""Should process np.nan argument as None """
1950-
# GH # 17276
1950+
# GH 17276
19511951
tm.assert_frame_equal(float_frame.clip(np.nan), float_frame)
19521952
tm.assert_frame_equal(float_frame.clip(upper=np.nan, lower=np.nan),
19531953
float_frame)
19541954

1955-
# GH #19992
1955+
# GH 19992
19561956
df = DataFrame({'col_0': [1, 2, 3], 'col_1': [4, 5, 6],
19571957
'col_2': [7, 8, 9]})
19581958

@@ -2025,7 +2025,7 @@ def test_dot(self):
20252025
_np_version_under1p12,
20262026
reason="unpredictable return types under numpy < 1.12")
20272027
def test_matmul(self):
2028-
# matmul test is for GH #10259
2028+
# matmul test is for GH 10259
20292029
a = DataFrame(np.random.randn(3, 4), index=['a', 'b', 'c'],
20302030
columns=['p', 'q', 'r', 's'])
20312031
b = DataFrame(np.random.randn(4, 2), index=['p', 'q', 'r', 's'],
@@ -2139,7 +2139,7 @@ class TestNLargestNSmallest(object):
21392139
['b', 'c', 'c']])
21402140
@pytest.mark.parametrize('n', range(1, 11))
21412141
def test_n(self, df_strings, nselect_method, n, order):
2142-
# GH10393
2142+
# GH 10393
21432143
df = df_strings
21442144
if 'b' in order:
21452145

@@ -2190,7 +2190,7 @@ def test_duplicates_on_starter_columns(self, method, expected):
21902190
tm.assert_frame_equal(result, expected)
21912191

21922192
def test_n_identical_values(self):
2193-
# GH15297
2193+
# GH 15297
21942194
df = pd.DataFrame({'a': [1] * 5, 'b': [1, 2, 3, 4, 5]})
21952195

21962196
result = df.nlargest(3, 'a')
@@ -2224,7 +2224,7 @@ def test_n_duplicate_index(self, df_duplicates, n, order):
22242224
tm.assert_frame_equal(result, expected)
22252225

22262226
def test_duplicate_keep_all_ties(self):
2227-
# see gh-16818
2227+
# GH 16818
22282228
df = pd.DataFrame({'a': [5, 4, 4, 2, 3, 3, 3, 3],
22292229
'b': [10, 9, 8, 7, 5, 50, 10, 20]})
22302230
result = df.nlargest(4, 'a', keep='all')

pandas/tests/frame/test_api.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def test_iteritems(self):
192192
assert isinstance(v, self.klass._constructor_sliced)
193193

194194
def test_items(self):
195-
# issue #17213, #13918
195+
# GH 17213, GH 13918
196196
cols = ['a', 'b', 'c']
197197
df = DataFrame([[1, 2, 3], [4, 5, 6]], columns=cols)
198198
for c, (k, v) in zip(cols, df.items()):
@@ -213,7 +213,7 @@ def test_iterrows(self, float_frame, float_string_frame):
213213
self._assert_series_equal(v, exp)
214214

215215
def test_iterrows_iso8601(self):
216-
# GH19671
216+
# GH 19671
217217
if self.klass == SparseDataFrame:
218218
pytest.xfail(reason='SparseBlock datetime type not implemented.')
219219

@@ -354,7 +354,7 @@ def test_axis_aliases(self, float_frame):
354354
assert_series_equal(result, expected)
355355

356356
def test_class_axis(self):
357-
# https://github.com/pandas-dev/pandas/issues/18147
357+
# GH 18147
358358
# no exception and no empty docstring
359359
assert pydoc.getdoc(DataFrame.index)
360360
assert pydoc.getdoc(DataFrame.columns)
@@ -366,9 +366,9 @@ def test_more_values(self, float_string_frame):
366366
def test_repr_with_mi_nat(self, float_string_frame):
367367
df = self.klass({'X': [1, 2]},
368368
index=[[pd.NaT, pd.Timestamp('20130101')], ['a', 'b']])
369-
res = repr(df)
370-
exp = ' X\nNaT a 1\n2013-01-01 b 2'
371-
assert res == exp
369+
result = repr(df)
370+
expected = ' X\nNaT a 1\n2013-01-01 b 2'
371+
assert result == expected
372372

373373
def test_iteritems_names(self, float_string_frame):
374374
for k, v in compat.iteritems(float_string_frame):
@@ -418,7 +418,7 @@ def test_values(self, float_frame):
418418
assert (float_frame.values[:, 0] == 5).all()
419419

420420
def test_as_matrix_deprecated(self, float_frame):
421-
# GH18458
421+
# GH 18458
422422
with tm.assert_produces_warning(FutureWarning):
423423
cols = float_frame.columns.tolist()
424424
result = float_frame.as_matrix(columns=cols)
@@ -439,7 +439,7 @@ def test_transpose_get_view(self, float_frame):
439439
assert (float_frame.values[5:10] == 5).all()
440440

441441
def test_inplace_return_self(self):
442-
# re #1893
442+
# GH 1893
443443

444444
data = DataFrame({'a': ['foo', 'bar', 'baz', 'qux'],
445445
'b': [0, 0, 1, 1],
@@ -503,7 +503,7 @@ def _check_f(base, f):
503503
_check_f(d.copy(), f)
504504

505505
def test_tab_complete_warning(self, ip):
506-
# https://github.com/pandas-dev/pandas/issues/16409
506+
# GH 16409
507507
pytest.importorskip('IPython', minversion="6.0.0")
508508
from IPython.core.completer import provisionalcompleter
509509

0 commit comments

Comments
 (0)