Constructing DataFrames using range fails · Issue #26342 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@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.