Skip to content

Conversation

@pbreach
Copy link
Contributor

@pbreach pbreach commented Dec 19, 2016

Explicit conversion to list for percentiles. Fixes the case where percentiles is passed as a numpy with no median (0.5) present. Closes #14908.

@sinhrks
Copy link
Member

sinhrks commented Dec 19, 2016

Thx, can u add tests and whatsnew?

@Appender(_shared_docs['describe'] % _shared_doc_kwargs)
def describe(self, percentiles=None, include=None, exclude=None):
# explicit conversion of `percentiles` to list
percentiles = list(percentiles)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks fail by default percentiles=None.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right - I think I could just move it under if percentiles is not None: instead

@sinhrks sinhrks added Bug Numeric Operations Arithmetic, Comparison, and Logical operations labels Dec 19, 2016
@codecov-io
Copy link

codecov-io commented Dec 19, 2016

Current coverage is 84.64% (diff: 100%)

Merging #14914 into master will increase coverage by 0.07%

@@ master #14914 diff @@ ========================================== Files 144 144 Lines 51057 51016 -41 Methods 0 0 Messages 0 0 Branches 0 0 ========================================== + Hits 43180 43185 +5  + Misses 7877 7831 -46  Partials 0 0 

Powered by Codecov. Last update f1cfe5b...5c8199b

self.assertTrue('100%' in d2.index)

def test_describe_percentiles_insert_median_ndarray(self):
df = tm.makeDataFrame()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the issue number here as a comment


def test_describe_percentiles_insert_median_ndarray(self):
df = tm.makeDataFrame()
try:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need the try/except at all; nose will simply fail the test if this raises.

rename d1 -> result, d2 -> expected

@jreback jreback added this to the 0.20.0 milestone Dec 19, 2016
@jreback
Copy link
Contributor

jreback commented Dec 19, 2016

small changes. ping on green.

@jreback
Copy link
Contributor

jreback commented Dec 19, 2016

lgtm. ping on green.

@jreback jreback closed this in 8e630b6 Dec 19, 2016
@jreback
Copy link
Contributor

jreback commented Dec 19, 2016

thanks!

@pbreach pbreach deleted the df-describe-percentile-ndarray-no-median branch December 19, 2016 22:03
@pbreach pbreach restored the df-describe-percentile-ndarray-no-median branch December 19, 2016 22:04
ShaharBental pushed a commit to ShaharBental/pandas that referenced this pull request Dec 26, 2016
Explicit conversion to list for `percentiles`. Fixes the case where `percentiles` is passed as a numpy with no median (0.5) present. Closes pandas-dev#14908. Author: pbreach <pbreach@uwo.ca> Closes pandas-dev#14914 from pbreach/df-describe-percentile-ndarray-no-median and squashes the following commits: 5c8199b [pbreach] Minor test fix b5d09a6 [pbreach] Added test for median insertion with ndarray 72fe0cb [pbreach] Added what's new entry f954392 [pbreach] Moved conversion to if percentiles is not None d192ac7 [pbreach] Fixed whitespace issue a06794d [pbreach] BUG: Fixed bug in DataFrame.describe when percentiles are passed as array with no median
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Numeric Operations Arithmetic, Comparison, and Logical operations

4 participants