Skip to content
Prev Previous commit
Next Next commit
Added test for median insertion with ndarray
  • Loading branch information
pbreach committed Dec 19, 2016
commit b5d09a6a384ffa348b4e15d92d3b9a87d873853c
9 changes: 9 additions & 0 deletions pandas/tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,15 @@ def test_describe_percentiles_insert_median(self):
self.assertTrue('0%' in d1.index)
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

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

d1 = df.describe(percentiles=np.array([.25, .75]))
except AttributeError:
self.fail
d2 = df.describe(percentiles=[.25, .75])
assert_frame_equal(d1, d2)

def test_describe_percentiles_unique(self):
# GH13104
df = tm.makeDataFrame()
Expand Down