Skip to content

BUG: string series to numpy array conversion #46371

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

Open
2 of 3 tasks
deepspacesparkle opened this issue Mar 15, 2022 · 1 comment
Open
2 of 3 tasks

BUG: string series to numpy array conversion #46371

deepspacesparkle opened this issue Mar 15, 2022 · 1 comment
Labels
Docs Strings String extension data type and string data

Comments

@deepspacesparkle
Copy link

deepspacesparkle commented Mar 15, 2022

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

df = pd.DataFrame({'a':["1","2","3"]}, dtype="string")

type(df['a'].values)
type(df['a'].unique())

Issue Description

I am getting pandas.core.arrays.string_.StringArray when converting pandas string series to NumPy array with unique or values methods. Could be associated with #46366

Expected Behavior

pandas.values and pandas.unique returns np.ndarray

Installed Versions

pandas: 1.3.5, numpy: 1.21.3

@deepspacesparkle deepspacesparkle added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 15, 2022
@SeanRBurton
Copy link

StringArray derives from ExtensionArray which is documented as a possible return type of unique. I would say this is more a case of insufficient documentation than a bug.

@mroeschke mroeschke added Docs Strings String extension data type and string data and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Strings String extension data type and string data
Projects
None yet
Development

No branches or pull requests

3 participants