CLN: replace pandas.compat.scipy.scoreatpercentile with numpy.percentile by gdraps · Pull Request #6810 · pandas-dev/pandas (original) (raw)
@jreback, sorry for the delay, but I've added a second commit to this PR with:
- added to release notes
Series.quantile
on datetime[ns] series changed to return aTimestamp
object (with an explicit test)- added a test for
Series.quantile
on timedelta64 series, which didn't require any
special handling, though the test is skipped at numpy 1.6.x, because
numpy.percentile throws the following exception with timedelta64 objects
pre-1.7:
TypeError: ufunc 'multiply' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule 'safe'
- removed timedelta64 handling (introduced by BUG: Series.quantile raising on an object dtype (GH6555) #6558) in
Series.quantile
,
becausenot np.isscalar
is always false and, in my testing,
numpy.percentile properly returns timedelta64 objects on numpy 1.7 & up.
No idea why np.percentile wasn't used originally, but will note that scipy.stats.scoreatpercentile existed first. Perhaps, when the scipy dependency was removed from pandas, the difference in rounding made copying scoreatpercentile the easiest way forward. Will also note that scipy has deprecated scoreatpercentile in favor of np.percentile.