{"action":"opened","issue":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/19760","repository_url":"https://api.github.com/repos/pandas-dev/pandas","labels_url":"https://api.github.com/repos/pandas-dev/pandas/issues/19760/labels{/name}","comments_url":"https://api.github.com/repos/pandas-dev/pandas/issues/19760/comments","events_url":"https://api.github.com/repos/pandas-dev/pandas/issues/19760/events","html_url":"https://github.com/pandas-dev/pandas/issues/19760","id":298192331,"number":19760,"title":"BUG: regression in DataFrame.transform('func')","user":{"login":"jorisvandenbossche","id":1020496,"avatar_url":"https://avatars2.githubusercontent.com/u/1020496?v=4","gravatar_id":"","url":"https://api.github.com/users/jorisvandenbossche","html_url":"https://github.com/jorisvandenbossche","followers_url":"https://api.github.com/users/jorisvandenbossche/followers","following_url":"https://api.github.com/users/jorisvandenbossche/following{/other_user}","gists_url":"https://api.github.com/users/jorisvandenbossche/gists{/gist_id}","starred_url":"https://api.github.com/users/jorisvandenbossche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jorisvandenbossche/subscriptions","organizations_url":"https://api.github.com/users/jorisvandenbossche/orgs","repos_url":"https://api.github.com/users/jorisvandenbossche/repos","events_url":"https://api.github.com/users/jorisvandenbossche/events{/privacy}","received_events_url":"https://api.github.com/users/jorisvandenbossche/received_events","type":"User","site_admin":false},"labels":[{"id":697792067,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/Apply","name":"Apply","color":"fbca04","default":false},{"id":32815646,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/Regression","name":"Regression","color":"e11d21","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/pandas-dev/pandas/milestones/53","html_url":"https://github.com/pandas-dev/pandas/milestone/53","labels_url":"https://api.github.com/repos/pandas-dev/pandas/milestones/53/labels","id":2853937,"number":53,"title":"0.23.0","description":"after 0.22","creator":{"login":"jreback","id":953992,"avatar_url":"https://avatars2.githubusercontent.com/u/953992?v=4","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"open_issues":114,"closed_issues":908,"state":"open","created_at":"2017-10-20T10:17:09Z","updated_at":"2018-02-19T08:23:58Z","due_on":"2018-03-31T07:00:00Z","closed_at":null},"comments":0,"created_at":"2018-02-19T08:23:57Z","updated_at":"2018-02-19T08:23:57Z","closed_at":null,"author_association":"OWNER","body":"From a failing example in the doc build:\r\n\r\n```python\r\ntsdf = pd.DataFrame(np.random.randn(10, 3), columns=['A', 'B', 'C'],\r\n                    index=pd.date_range('1/1/2000', periods=10))\r\ntsdf.iloc[3:7] = np.nan\r\n```\r\n\r\nUsing a numpy func directly is fine:\r\n```\r\nIn [43]: tsdf.transform(np.abs)\r\nOut[43]: \r\n                   A         B         C\r\n2000-01-01  1.038786  0.380848  1.190139\r\n2000-01-02  2.201640  0.004028  0.704541\r\n2000-01-03  1.803344  0.774565  0.034836\r\n2000-01-04       NaN       NaN       NaN\r\n2000-01-05       NaN       NaN       NaN\r\n2000-01-06       NaN       NaN       NaN\r\n2000-01-07       NaN       NaN       NaN\r\n2000-01-08  0.351827  0.265785  1.424491\r\n2000-01-09  0.962042  1.291740  1.107973\r\n2000-01-10  0.366717  0.318791  0.117215\r\n```\r\n\r\nBut specifying the function with a string now breaks:\r\n```\r\nIn [44]: tsdf.transform('abs')\r\n---------------------------------------------------------------------------\r\nTypeError                                 Traceback (most recent call last)\r\n<ipython-input-44-405a88736ee3> in <module>()\r\n----> 1 tsdf.transform('abs')\r\n\r\n/home/joris/scipy/pandas/pandas/core/generic.py in transform(self, func, *args, **kwargs)\r\n   7694         @Appender(_shared_docs['transform'] % _shared_doc_kwargs)\r\n   7695         def transform(self, func, *args, **kwargs):\r\n-> 7696             result = self.agg(func, *args, **kwargs)\r\n   7697             if is_scalar(result) or len(result) != len(self):\r\n   7698                 raise ValueError(\"transforms cannot produce \"\r\n\r\n/home/joris/scipy/pandas/pandas/core/frame.py in aggregate(self, func, axis, *args, **kwargs)\r\n   4830                 pass\r\n   4831         if result is None:\r\n-> 4832             return self.apply(func, axis=axis, args=args, **kwargs)\r\n   4833         return result\r\n   4834 \r\n\r\n/home/joris/scipy/pandas/pandas/core/frame.py in apply(self, func, axis, broadcast, raw, reduce, result_type, args, **kwds)\r\n   5020                          args=args,\r\n   5021                          kwds=kwds)\r\n-> 5022         return op.get_result()\r\n   5023 \r\n   5024     def applymap(self, func):\r\n\r\n/home/joris/scipy/pandas/pandas/core/apply.py in get_result(self)\r\n    309                                       *self.args, **self.kwds)\r\n    310 \r\n--> 311         return super(FrameRowApply, self).get_result()\r\n    312 \r\n    313     def apply_broadcast(self):\r\n\r\n/home/joris/scipy/pandas/pandas/core/apply.py in get_result(self)\r\n    113         if isinstance(self.f, compat.string_types):\r\n    114             self.kwds['axis'] = self.axis\r\n--> 115             return getattr(self.obj, self.f)(*self.args, **self.kwds)\r\n    116 \r\n    117         # ufunc\r\n\r\nTypeError: abs() got an unexpected keyword argument 'axis'\r\n```\r\n\r\nThis is on master, while it was working in 0.22 (tested with the same version of numpy, 1.13)"}}
{"actor":{"display_login":"jorisvandenbossche"}}