BUG: DataFrame.apply fails on timezone aware datetime data · Issue #12244 · pandas-dev/pandas (original) (raw)

In [29]: df = pd.DataFrame({'dt': pd.date_range("2015-01-01", periods=3, tz='Europe/Brussels')})

In [30]: df
Out[30]:
                         dt
0 2015-01-01 00:00:00+01:00
1 2015-01-02 00:00:00+01:00
2 2015-01-03 00:00:00+01:00

In [31]: df.apply(lambda x: x)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-31-9cd68f0fd3ff> in <module>()
----> 1 df.apply(lambda x: x)

c:\users\vdbosscj\scipy\pandas-joris\pandas\core\frame.py in apply(self, func, a
xis, broadcast, raw, reduce, args, **kwds)
   4029                     if reduce is None:
   4030                         reduce = True
-> 4031                     return self._apply_standard(f, axis, reduce=reduce)
   4032             else:
   4033                 return self._apply_broadcast(f, axis)

c:\users\vdbosscj\scipy\pandas-joris\pandas\core\frame.py in _apply_standard(sel
f, func, axis, ignore_failures, reduce)
   4076             # Create a dummy Series from an empty array
   4077             index = self._get_axis(axis)
-> 4078             empty_arr = np.empty(len(index), dtype=values.dtype)
   4079             dummy = Series(empty_arr, index=self._get_axis(axis),
   4080                            dtype=values.dtype)

TypeError: data type not understood