-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: concat of Series w/o names #10698 #10723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1879,6 +1879,24 @@ def test_concat_dataframe_keys_bug(self): | |
self.assertEqual(list(result.columns), [('t1', 'value'), | ||
('t2', 'value')]) | ||
|
||
def test_concat_series_partial_columns_names(self): | ||
# GH10698 | ||
foo = pd.Series([1,2], name='foo') | ||
bar = pd.Series([1,2]) | ||
baz = pd.Series([4,5]) | ||
|
||
result = pd.concat([foo, bar, baz], axis=1) | ||
expected = DataFrame({'foo' : [1,2], 0 : [1,2], 1 : [4,5]}, columns=['foo',0,1]) | ||
tm.assert_frame_equal(result, expected) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. put a test that overrides this with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a test using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm adding it now. I will push a new version in a few minutes time. |
||
result = pd.concat([foo, bar, baz], axis=1, keys=['red','blue','yellow']) | ||
expected = DataFrame({'red' : [1,2], 'blue' : [1,2], 'yellow' : [4,5]}, columns=['red','blue','yellow']) | ||
tm.assert_frame_equal(result, expected) | ||
|
||
result = pd.concat([foo, bar, baz], axis=1, ignore_index=True) | ||
expected = DataFrame({0 : [1,2], 1 : [1,2], 2 : [4,5]}) | ||
tm.assert_frame_equal(result, expected) | ||
|
||
def test_concat_dict(self): | ||
frames = {'foo': DataFrame(np.random.randn(4, 3)), | ||
'bar': DataFrame(np.random.randn(4, 3)), | ||
|
@@ -2412,7 +2430,7 @@ def test_concat_series_axis1(self): | |
|
||
s2.name = None | ||
result = concat([s, s2], axis=1) | ||
self.assertTrue(np.array_equal(result.columns, lrange(2))) | ||
self.assertTrue(np.array_equal(result.columns, Index(['A', 0], dtype='object'))) | ||
|
||
# must reindex, #2603 | ||
s = Series(randn(3), index=['c', 'a', 'b'], name='A') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the issue number as a comment here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the reference to the GitHub issue