Skip to content

Conversation

@simonjayhawkins
Copy link
Member

pandas\core\frame.py:1091: error: namedtuple() expects a string literal as the first argument [misc]
pandas\core\frame.py:4594: error: Need type annotation for 'names' (hint: "names: List[] = ...") [var-annotated]

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Aug 30, 2020
if name is not None:
itertuple = collections.namedtuple(name, fields, rename=True)
# https://github.com/python/mypy/issues/848
# error: namedtuple() expects a string literal as the first argument [misc]
Copy link
Member

Choose a reason for hiding this comment

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

cant do a cast or assert?

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm, I've got the wrong mypy issue here.

cant do a cast or assert?

no, it has to be a string literal and doesn't look like mypy will change.

see python/mypy#9046 (comment)

we can remove this ignore with Final in Python 3.8 (and a later version of mypy)

@jbrockmendel jbrockmendel merged commit f46ebe8 into pandas-dev:master Aug 31, 2020
@jbrockmendel
Copy link
Member

thanks @simonjayhawkins

@simonjayhawkins simonjayhawkins deleted the pandas-core-frame.py branch August 31, 2020 16:23
jbrockmendel pushed a commit to jbrockmendel/pandas that referenced this pull request Aug 31, 2020
* TYP: misc typing fixes for pandas\core\frame.py

* correct issue number
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
* TYP: misc typing fixes for pandas\core\frame.py

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

Labels

Typing type annotations, mypy/pyright type checking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants