Skip to content

Commit f5c50f3

Browse files
author
y-p
committed
TST: DataFrame.to_records(index=True) doesn't work with MultiIndex GH3189
1 parent 4a7dbbe commit f5c50f3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/test_frame.py

+10
Original file line numberDiff line numberDiff line change
@@ -3303,6 +3303,16 @@ def test_to_records_dt64(self):
33033303
rs = df.to_records(convert_datetime64=False)
33043304
self.assert_(rs['index'][0] == df.index.values[0])
33053305

3306+
def test_to_records_with_multindex(self):
3307+
# GH3189
3308+
index = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],
3309+
['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]
3310+
data = np.zeros((8, 4))
3311+
df = DataFrame(data, index=index)
3312+
r = df.to_records(index=True)['level_0']
3313+
self.assertTrue('bar' in r)
3314+
self.assertTrue('one' not in r)
3315+
33063316
def test_to_records_with_Mapping_type(self):
33073317
import email
33083318
from email.parser import Parser

0 commit comments

Comments
 (0)