Skip to content

Constructing DataFrames using range fails #26342

Closed
@topper-123

Description

@topper-123

Working on removing compat.lrange, I've discovered that 1-dim lists, iterators and generators work as expected:

>>> pd.DataFrame(list(range(3)))  # ok
   0
0  0
1  1
2  2
>>> pd.DataFrame(iter(range(3)))  # ok
   0
0  0
1  1
2  2
>>> pd.DataFrame((i for i in range(3))  # ok
   0
0  0
1  1
2  2

while constructing with a plain range does not work:

>>> pd.DataFrame(range(3))  # not ok
AttributeError: 'range' object has no attribute 'ndim'

Fix upcoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDataFrameDataFrame data structure

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions