Skip to content

ENH: Add ea support to get_dummies #50849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 23, 2023
Merged

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
@@ -240,9 +241,9 @@ def _get_dummies_1d(

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