8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a814ea4 commit a488ab8Copy full SHA for a488ab8
pandas/tests/series/test_apply.py
@@ -163,6 +163,18 @@ def test_apply_dict_depr(self):
163
with tm.assert_produces_warning(FutureWarning):
164
tsdf.A.agg({'foo': ['sum', 'mean']})
165
166
+ @pytest.mark.parametrize('series', [
167
+ ['1-1', '1-1', np.NaN],
168
+ ['1-1', '1-2', np.NaN]])
169
+ def test_apply_categorical_with_nan_values(self, series):
170
+ # GH 20714 bug fixed in: GH 24275
171
+ s = pd.Series(series, dtype='category')
172
+ result = s.apply(lambda x: x.split('-')[0])
173
+ result = result.astype(object)
174
+ expected = pd.Series(['1', '1', np.NaN], dtype='category')
175
+ expected = expected.astype(object)
176
+ tm.assert_series_equal(result, expected)
177
+
178
179
class TestSeriesAggregate():
180
0 commit comments