Skip to content

Conversation

@evertlammerts
Copy link
Collaborator

…version

fixes #120

Copy link
Collaborator

@Tishj Tishj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks LGTM

@paultiq
Copy link
Contributor

paultiq commented Oct 31, 2025

Why not just

static void ReplaceDFColumn(PandasDataFrame &df, const char *col_name, idx_t idx, const py::handle &new_value) {
	df.attr("__setitem__")(col_name, new_value);
}

* This is same as used in FrameFromNumpy.

In Python, we wouldn't perform two operations to replace a column (drop then insert in position). We'd just set it: df["mycol"] = ...., which preserves position.

... As a general rule, explicit "inplace" params in Pandas is something to avoid. See https://pandas.pydata.org/pdeps/0008-inplace-methods-in-pandas.html for a longer discussion of if.

@evertlammerts evertlammerts merged commit fd1c34f into duckdb:v1.4-andium Oct 31, 2025
1 check passed
@evertlammerts evertlammerts deleted the arrow_col_fix branch October 31, 2025 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants