File tree 3 files changed +12
-17
lines changed
3 files changed +12
-17
lines changed Original file line number Diff line number Diff line change @@ -284,11 +284,10 @@ Bug Fixes
284
284
- Bug in ``DataFrame(..).apply(to_numeric)`` when values are of type decimal.Decimal. (:issue:`14827`)
285
285
- Bug in ``describe()`` when passing a numpy array which does not contain the median to the ``percentiles`` keyword argument (:issue:`14908`)
286
286
- Bug in ``DataFrame.sort_values()`` when sorting by multiple columns where one column is of type ``int64`` and contains ``NaT`` (:issue:`14922`)
287
-
287
+ - Bug in ``applymap()`` returning a ``Series`` with an empty ``DataFrame`` (:issue:`8222`)
288
288
289
289
290
290
- Bug in ``pd.read_msgpack()`` in which ``Series`` categoricals were being improperly processed (:issue:`14901`)
291
- - Bug in ``Series.ffill()`` with mixed dtypes containing tz-aware datetimes. (:issue:`14956`)
292
291
293
292
294
293
@@ -301,20 +300,5 @@ Bug Fixes
301
300
302
301
- Bug in ``Series.unique()`` in which unsigned 64-bit integers were causing overflow (:issue:`14721`)
303
302
- Bug in ``pd.unique()`` in which unsigned 64-bit integers were causing overflow (:issue:`14915`)
304
-
305
-
306
-
307
-
308
-
309
-
310
-
311
-
312
-
313
-
314
-
315
-
316
-
317
-
318
303
- Require at least 0.23 version of cython to avoid problems with character encodings (:issue:`14699`)
319
304
- Bug in converting object elements of array-like objects to unsigned 64-bit integers (:issue:`4471`)
320
- - Bug in ``pd.pivot_table()`` where no error was raised when values argument was not in the columns (:issue:`14938`)
Original file line number Diff line number Diff line change @@ -4288,6 +4288,8 @@ def applymap(self, func):
4288
4288
4289
4289
# if we have a dtype == 'M8[ns]', provide boxed values
4290
4290
def infer (x ):
4291
+ if x .empty :
4292
+ return lib .map_infer (x , func )
4291
4293
return lib .map_infer (x .asobject , func )
4292
4294
4293
4295
return self .apply (infer )
Original file line number Diff line number Diff line change @@ -405,6 +405,15 @@ def test_applymap(self):
405
405
for f in ['datetime' , 'timedelta' ]:
406
406
self .assertEqual (result .loc [0 , f ], str (df .loc [0 , f ]))
407
407
408
+ # GH 8222
409
+ empty_frames = [pd .DataFrame (),
410
+ pd .DataFrame (columns = list ('ABC' )),
411
+ pd .DataFrame (index = list ('ABC' ))]
412
+ for frame in empty_frames :
413
+ for func in [round , lambda x : x ]:
414
+ result = frame .applymap (func )
415
+ tm .assert_frame_equal (result , frame )
416
+
408
417
def test_applymap_box (self ):
409
418
# ufunc will not be boxed. Same test cases as the test_map_box
410
419
df = pd .DataFrame ({'a' : [pd .Timestamp ('2011-01-01' ),
You can’t perform that action at this time.
0 commit comments