Skip to content
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

String dtype: honor mode.string_storage option (and change default to None) #59488

Merged

Conversation

jorisvandenbossche
Copy link
Member

@jorisvandenbossche jorisvandenbossche commented Aug 12, 2024

At the moment, the pd.options.mode.string_storage option defaults to "python", and the StringDtype() constructor just ignores it when constructing the future default NaN-variant (i.e. the option is only used for creating the NA-variant), but uses the logic of "use "pyarrow" if installed otherwise "python"".

Given this option exists, I think it makes sense to let it always be honored, so that a user can actually control this through the option (and also for testing this makes things a bit easier to check the behaviour in case pyarrow is not installed without uninstalling/installing it constantly).

In order to honor the option, I changed the default to None to mean this "use "pyarrow" if installed otherwise "python"" logic as default if constructing the NaN-variant.
When constructing the NA-variant, for now None still gets translated to "python". I think we should also change the default for this dtype to use pyarrow if installed, but that's a change only for 3.0, I think (not to backport for 2.3), so therefore didn't include that in this PR.

xref #54792

@jorisvandenbossche jorisvandenbossche added the Strings String extension data type and string data label Aug 12, 2024
@jorisvandenbossche
Copy link
Member Author

Should I use "auto" instead of None for the default? (for some other options like the parquet engine we use "auto" for the default that depends on what is installed)

@WillAyd
Copy link
Member

WillAyd commented Aug 12, 2024

Should I use "auto" instead of None for the default? (for some other options like the parquet engine we use "auto" for the default that depends on what is installed)

Yea I prefer auto for string options like this

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

lgtm ex changing None to auto

@mroeschke mroeschke added this to the 3.0 milestone Aug 12, 2024
@mroeschke mroeschke merged commit 8ab673c into pandas-dev:main Aug 12, 2024
47 checks passed
@mroeschke
Copy link
Member

Thanks @jorisvandenbossche

WillAyd pushed a commit that referenced this pull request Aug 13, 2024
… None) (#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
@jorisvandenbossche jorisvandenbossche deleted the string-dtype-honor-storage-option branch August 13, 2024 06:06
shreyas-dev pushed a commit to shreyas-dev/pandas that referenced this pull request Aug 13, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
WillAyd pushed a commit to WillAyd/pandas that referenced this pull request Aug 14, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
WillAyd pushed a commit to WillAyd/pandas that referenced this pull request Aug 15, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
WillAyd pushed a commit to WillAyd/pandas that referenced this pull request Aug 15, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
WillAyd pushed a commit to WillAyd/pandas that referenced this pull request Aug 15, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
@jorisvandenbossche jorisvandenbossche modified the milestones: 3.0, 2.3 Aug 20, 2024
WillAyd pushed a commit to WillAyd/pandas that referenced this pull request Aug 21, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
WillAyd pushed a commit to WillAyd/pandas that referenced this pull request Aug 22, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
WillAyd pushed a commit to WillAyd/pandas that referenced this pull request Aug 22, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
WillAyd pushed a commit to WillAyd/pandas that referenced this pull request Aug 22, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
WillAyd pushed a commit to WillAyd/pandas that referenced this pull request Aug 27, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
WillAyd pushed a commit to WillAyd/pandas that referenced this pull request Sep 20, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
jorisvandenbossche added a commit to WillAyd/pandas that referenced this pull request Oct 2, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
jorisvandenbossche added a commit to WillAyd/pandas that referenced this pull request Oct 2, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
jorisvandenbossche added a commit to WillAyd/pandas that referenced this pull request Oct 3, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
jorisvandenbossche added a commit to WillAyd/pandas that referenced this pull request Oct 7, 2024
… None) (pandas-dev#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
jorisvandenbossche added a commit that referenced this pull request Oct 9, 2024
… None) (#59488)

* String dtype: honor mode.string_storage option (and change default to None)

* fix test + explicitly test default

* use 'auto' instead of None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Strings String extension data type and string data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants