Skip to content

BUG: GH3243 accept list of DataFrames as constructor input #3245

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

Merged
merged 1 commit into from
Apr 3, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ def _possibly_convert_platform(values):

if isinstance(values, (list,tuple)):
values = lib.list_to_object_array(values)
if values.dtype == np.object_:
if getattr(values,'dtype',None) == np.object_:
values = lib.maybe_convert_objects(values)

return values
Expand Down
9 changes: 9 additions & 0 deletions pandas/tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,15 @@ def test_constructor_dtype_list_data(self):
self.assert_(df.ix[1, 0] is None)
self.assert_(df.ix[0, 1] == '2')

def test_constructor_list_frames(self):

# GH 3243
result = DataFrame([DataFrame([])])
self.assert_(result.shape == (1,0))

result = DataFrame([DataFrame(dict(A = range(5)))])
self.assert_(type(result.iloc[0,0]) == DataFrame)

def test_constructor_mixed_dtypes(self):

def _make_mixed_dtypes_df(typ, ad = None):
Expand Down