COMPAT: Further Expand Compatibility with fromnumeric.py by gfyoung · Pull Request #13148 · pandas-dev/pandas (original) (raw)

Okay, I think we might need to undo this compatibility change to tslib.pyx. If anyone complains about it, say that "round in numpy is for arrays and not timestamps, and you shouldn't be doing that" (currently, the function will throw an error because keyword arguments like decimals and out are not in the signature and shouldn't be). Here is why:

signature in tslib.pyx

def round(self, freq, *args, **kwargs): ...

signature in numpy master

def around(a, decimals=0, out=None): return _wrapfunc(a, 'round', decimals=decimals, out=out)

When we call np.round(timestamp, freq), freq is being passed in as the decimals argument. However, decimals is being passed in with a **kwargs bundle, so it isn't being picked up as the positional argument needed for freq. I forgot that that change was not in v1.11.0 but was in master. My bad for not checking.