Skip to content

DataFrame.assign() should allow a list and a range #1248

Open
@Dr-Irv

Description

@Dr-Irv

Describe the bug

DataFrame.assign() should allow lists and ranges

To Reproduce

import pandas as pd
df = pd.DataFrame({"a": [1,2,3]})
df = df.assign(b=lambda df: range(len(df)), c=lambda df: [10,20,30])

Need to update IntoColumn in _typing.pyi to include list[Scalar] and range

Please complete the following information:

  • OS: Windows 11
  • python version 3.10
  • pyright 1.1.400
  • version of installed pandas-stubs : development version

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions