Skip to content

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

@Dr-Irv

Description

@Dr-Irv
Collaborator

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

Activity

changed the title [-]`DataFrame.assign(` should allow a list and a range[/-] [+]`DataFrame.assign()` should allow a list and a range[/+] on Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @Dr-Irv

      Issue actions

        `DataFrame.assign()` should allow a list and a range · Issue #1248 · pandas-dev/pandas-stubs