Skip to content

BUG: to_stata not handling ea dtypes correctly #56771

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 2 commits into from
Jan 8, 2024
Merged

Conversation

phofl
Copy link
Member

@phofl phofl commented Jan 7, 2024

@phofl phofl added IO Stata read_stata, to_stata NA - MaskedArrays Related to pd.NA and nullable extension arrays Arrow pyarrow functionality labels Jan 7, 2024
@@ -591,17 +591,21 @@ def _cast_to_stata_types(data: DataFrame) -> DataFrame:

for col in data:
# Cast from unsupported types to supported types
is_nullable_int = isinstance(data[col].dtype, (IntegerDtype, BooleanDtype))
is_nullable_int = (
is_extension_array_dtype(data[col].dtype) and data[col].dtype.kind in "iub"
Copy link
Member

Choose a reason for hiding this comment

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

Just check isinstance ExtensionDtype

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

@mroeschke mroeschke added this to the 2.2 milestone Jan 8, 2024
@mroeschke mroeschke merged commit e619d08 into pandas-dev:main Jan 8, 2024
@mroeschke
Copy link
Member

Thanks @phofl

meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Jan 8, 2024
@phofl phofl deleted the 54671 branch January 8, 2024 21:32
mroeschke pushed a commit that referenced this pull request Jan 8, 2024
…pes correctly) (#56783)

Backport PR #56771: BUG: to_stata not handling ea dtypes correctly

Co-authored-by: Patrick Hoefler <[email protected]>
pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
* BUG: to_stata not handling ea dtypes correctly

* Fixup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arrow pyarrow functionality IO Stata read_stata, to_stata NA - MaskedArrays Related to pd.NA and nullable extension arrays
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: PyArrow-backed DataFrame not exportable to Stata format
3 participants