Skip to content

Conversation

@cmp0xff
Copy link
Contributor

@cmp0xff cmp0xff commented Dec 15, 2025

@cmp0xff cmp0xff force-pushed the feature/setitem-none branch from 6f392cb to 746c760 Compare December 15, 2025 12:13
Comment on lines 430 to 434
df.loc[:, ["x"]] = [[None], [pd.NA], [pd.NaT]] # type: ignore[assignment,index]
df.iloc[:, [0]] = [[None], [pd.NA], [pd.NaT]] # type: ignore[assignment,index]

df.loc[:, iter(["x"])] = [[None], [pd.NA], [pd.NaT]] # type: ignore[assignment,index]
df.iloc[:, iter([0])] = [[None], [pd.NA], [pd.NaT]] # type: ignore[assignment,index]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not too sure why they don't work for mypy

Copy link
Member

Choose a reason for hiding this comment

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

@Dr-Irv any insights on this one? I tried and got the same error.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's a mypy bug and a difference between the pyright setting of strictListInference, which we have turned on because we are using pyright in strict mode.

I created python/mypy#20420

Can you add a comment referring to the above issue for those tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @Dr-Irv , 4682c1a

Comment on lines +94 to +95
df[["col1"]] = [[None], [pd.NA]] # type: ignore[assignment,list-item]
df[iter(["col1"])] = [[None], [pd.NA]] # type: ignore[assignment]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not too sure why they don't work for mypy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cmp0xff cmp0xff marked this pull request as ready for review December 15, 2025 12:48
Copy link
Member

@loicdiridollou loicdiridollou left a comment

Choose a reason for hiding this comment

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

Will approve preemptively, just one question for @Dr-Irv and then we should be good.

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.

__setitem__ should accept sequences containing None?

3 participants