Skip to content

Commit 566304f

Browse files
committed
TST: DataFrame.append test, address concern in GH #276
1 parent de98e24 commit 566304f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pandas/tests/test_frame.py

+13
Original file line numberDiff line numberDiff line change
@@ -1712,6 +1712,19 @@ def test_append_records(self):
17121712
expected = DataFrame(np.concatenate((arr1, arr2)))
17131713
assert_frame_equal(result, expected)
17141714

1715+
def test_append_different_columns(self):
1716+
df = DataFrame({'bools' : np.random.randn(10) > 0,
1717+
'ints' : np.random.randint(0, 10, 10),
1718+
'floats' : np.random.randn(10),
1719+
'strings' : ['foo', 'bar'] * 5})
1720+
1721+
a = df[:5].ix[:, ['bools', 'ints', 'floats']]
1722+
b = df[5:].ix[:, ['strings', 'ints', 'floats']]
1723+
1724+
appended = a.append(b)
1725+
self.assert_(isnull(appended['strings'][:5]).all())
1726+
self.assert_(isnull(appended['bools'][5:]).all())
1727+
17151728
def test_asfreq(self):
17161729
offset_monthly = self.tsframe.asfreq(datetools.bmonthEnd)
17171730
rule_monthly = self.tsframe.asfreq('EOM')

0 commit comments

Comments
 (0)