Skip to content

BUG: Series.tolist to return None in place of pd.NA #51056

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

Closed
wants to merge 11 commits into from

Conversation

lukemanley
Copy link
Member

@lukemanley lukemanley commented Jan 29, 2023

As discussed here: #29738 (comment)

Offering this up as a potential solution to make Series.tolist return None (python native types) in place of pd.NA. This would make Series.tolist consistent with Series.to_dict which at the moment differ:

In [1]: import pandas as pd

In [2]: ser = pd.Series([1, pd.NA], dtype="Int64")

In [3]: ser.to_dict()
Out[3]: {0: 1, 1: None}

In [4]: ser.tolist()
Out[4]: [1, <NA>]

I don't think this fully closes #29738 as there may still be an open question about __iter__.

@lukemanley lukemanley added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Dtype Conversions Unexpected or buggy dtype conversions labels Jan 29, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2023

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Mar 7, 2023
@lukemanley lukemanley closed this Mar 11, 2023
@lukemanley lukemanley deleted the ea-tolist-na branch March 17, 2023 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API: ExtensionArrays and conversion to "native" types (eg in tolist, to_dict, iteration, ..)
1 participant