Skip to content

BUG: frame_length_0[key] = nonempty_frame raises ValueError #38831

@jbrockmendel

Description

@jbrockmendel
Member
df = pd.DataFrame(columns=["A", "B"])

other = pd.DataFrame({"B": [1, 2]})

>>> df["B"] = other
ValueError: Cannot set a frame with no defined index and a value that cannot be converted to a Series

>>> df[["B"]] = other   # <-- works as expected

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Participants

      @jreback@jbrockmendel@rhshadrach

      Issue actions

        BUG: frame_length_0[key] = nonempty_frame raises ValueError · Issue #38831 · pandas-dev/pandas