Skip to content

Commit

Permalink
TST: tests for categorical apply (#25095)
Browse files Browse the repository at this point in the history
  • Loading branch information
alimcmaster1 authored and jreback committed Feb 3, 2019
1 parent a814ea4 commit a488ab8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pandas/tests/series/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,18 @@ def test_apply_dict_depr(self):
with tm.assert_produces_warning(FutureWarning):
tsdf.A.agg({'foo': ['sum', 'mean']})

@pytest.mark.parametrize('series', [
['1-1', '1-1', np.NaN],
['1-1', '1-2', np.NaN]])
def test_apply_categorical_with_nan_values(self, series):
# GH 20714 bug fixed in: GH 24275
s = pd.Series(series, dtype='category')
result = s.apply(lambda x: x.split('-')[0])
result = result.astype(object)
expected = pd.Series(['1', '1', np.NaN], dtype='category')
expected = expected.astype(object)
tm.assert_series_equal(result, expected)


class TestSeriesAggregate():

Expand Down

0 comments on commit a488ab8

Please sign in to comment.