Skip to content

Conversation

@phofl
Copy link
Member

@phofl phofl commented Jan 18, 2023

@mroeschke
Copy link
Member

pyright 1.1.276
/home/runner/work/pandas/pandas/pandas/core/reshape/encoding.py
  /home/runner/work/pandas/pandas/pandas/core/reshape/encoding.py:245:13 - error: Expression of type "DtypeObj" cannot be assigned to declared type "str | dtype | Type[str] | Type[complex] | Type[bool] | Type[object] | None"
    Type "DtypeObj" cannot be assigned to type "str | dtype | Type[str] | Type[complex] | Type[bool] | Type[object] | None"
      Type "ExtensionDtype" cannot be assigned to type "str | dtype | Type[str] | Type[complex] | Type[bool] | Type[object] | None"
        "ExtensionDtype" is incompatible with "str"
        "ExtensionDtype" is incompatible with "dtype"
        Type "ExtensionDtype" cannot be assigned to type "Type[str]"
        Type "ExtensionDtype" cannot be assigned to type "Type[complex]"
        Type "ExtensionDtype" cannot be assigned to type "Type[bool]"
        Type "ExtensionDtype" cannot be assigned to type "Type[object]"
    ... (reportGeneralTypeIssues)
1 error, 0 warnings, 0 informations 
Completed in 18.065sec

mypy.....................................................................Failed
- hook id: mypy
- duration: 216.68s
- exit code: 1

pandas/core/reshape/encoding.py:245: error: Incompatible types in assignment (expression has type "Union[dtype[Any], ExtensionDtype]", variable has type "Optional[Union[str, dtype[Any], Type[str], Type[complex], Type[bool], Type[object]]]")  [assignment]

@mroeschke mroeschke added the NA - MaskedArrays Related to pd.NA and nullable extension arrays label Jan 19, 2023
@phofl
Copy link
Member Author

phofl commented Jan 19, 2023

Thx, fixed

@mroeschke mroeschke added this to the 2.0 milestone Jan 23, 2023
@mroeschke mroeschke merged commit 0cee41f into pandas-dev:main Jan 23, 2023
@mroeschke
Copy link
Member

Thanks @phofl

@phofl phofl deleted the enh_get_dummies branch January 24, 2023 01:18
pooja-subramaniam pushed a commit to pooja-subramaniam/pandas that referenced this pull request Jan 25, 2023
* ENH: Add ea support to get_dummies

* Fix mypy
if dtype is None:
dtype = np.dtype(bool)
dtype = np.dtype(dtype)
_dtype = pandas_dtype(dtype)
Copy link
Member

Choose a reason for hiding this comment

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

looks like this makes the annotation incorrect?

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

Labels

NA - MaskedArrays Related to pd.NA and nullable extension arrays

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: support nullable dtypes in get_dummies

3 participants