Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Vectorize pandas.Series.apply #355

Closed
wants to merge 5 commits into
from
View
@@ -1353,8 +1353,8 @@ def apply(self, func):
result = Series(result, index=self.index, name=self.name)
return result
except Exception:
- return Series([func(x) for x in self], index=self.index,
- name=self.name)
+ vfunc = np.vectorize(func)
+ return Series(vfunc(self), index=self.index,name=self.name)
def align(self, other, join='outer', copy=True):
"""