EA interface: rename ExtensionArray._hasnans to ._hasna
State: closed

As discussed in follow-up on https://github.com/pandas-dev/pandas/pull/45024#discussion_r774711601

Since this is "public" for developers, we need to decide on a name now for 1.4. Using "na" instead of "nan" makes it consistent with the other missing values related methods in the EA interface (isna, dropna, fillna, _can_hold_na)

Labels:
name: ExtensionArray
description: Extending pandas with custom dtypes or arrays.

Comments:
@jorisvandenbossche no more on 1.4
This is an innocent name change, but important to do now since it's public API. Given that the release is planned tomorrow or Sunday, I think that is certainly still enough time to merge something like this. 
could add to the list here https://github.com/pandas-dev/pandas/pull/45519/files#diff-3f7d3759a83cc1c72e82eba2dca1ba180a8e9b7fd7eefde9e906ec349a214bdaL121
I chose _hasnans to be consistent with the Index.hasnans method, dont really give a darn.
> I chose _hasnans to be consistent with the Index.hasnans method, dont really give a darn.

we could change that too
> > I chose _hasnans to be consistent with the Index.hasnans method, dont really give a darn.
> 
> we could change that too

As that's public wouldn't that need a deprecation
> > > I chose _hasnans to be consistent with the Index.hasnans method, dont really give a darn.
> > 
> > 
> > we could change that too
> 
> As that's public wouldn't that need a deprecation

no its experimental on an EA and private on Index
Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

1. Checkout backport branch and update it.

```
git checkout 1.4.x
git pull
```

2. Cherry pick the first parent branch of the this PR on top of the older branch:
```
git cherry-pick -m1 a0b40c0f2ad73420a54e48ec4f564b9667e3f452
```

3. You will likely have some merge/cherry-pick conflict here, fix them and commit:

```
git commit -am 'Backport PR #45519: EA interface: rename ExtensionArray._hasnans to ._hasna'
```

4. Push to a named branch:

```
git push YOURFORK 1.4.x:auto-backport-of-pr-45519-on-1.4.x
```

5. Create a PR against branch 1.4.x, I would have named this PR:

> "Backport PR #45519 on branch 1.4.x (EA interface: rename ExtensionArray._hasnans to ._hasna)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the `Still Needs Manual Backport` label once the PR gets merged.

If these instructions are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).
                
@meeseeksdev backport 1.4.x
@jorisvandenbossche if you can followup with a change in the docs (e.g. add _hasna) & also we need to followup on Index.
Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

1. Checkout backport branch and update it.

```
git checkout 1.4.x
git pull
```

2. Cherry pick the first parent branch of the this PR on top of the older branch:
```
git cherry-pick -m1 a0b40c0f2ad73420a54e48ec4f564b9667e3f452
```

3. You will likely have some merge/cherry-pick conflict here, fix them and commit:

```
git commit -am 'Backport PR #45519: EA interface: rename ExtensionArray._hasnans to ._hasna'
```

4. Push to a named branch:

```
git push YOURFORK 1.4.x:auto-backport-of-pr-45519-on-1.4.x
```

5. Create a PR against branch 1.4.x, I would have named this PR:

> "Backport PR #45519 on branch 1.4.x (EA interface: rename ExtensionArray._hasnans to ._hasna)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the `Still Needs Manual Backport` label once the PR gets merged.

If these instructions are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).
                
this needs a manual backport @jorisvandenbossche @simonjayhawkins 
> > > > I chose _hasnans to be consistent with the Index.hasnans method, dont really give a darn.
> > > 
> > > 
> > > we could change that too
> > 
> > 
> > As that's public wouldn't that need a deprecation
> 
> no its experimental on an EA and private on Index

ok. should probably remove from the docs https://pandas.pydata.org/pandas-docs/dev/reference/api/pandas.Index.hasnans.html
> no its experimental on an EA and private on Index

`hasnans` is a public property on both Index and Series, so as Simon says, that would need to be deprecated if we want to remove that. But that's a separate discussion.

@simonjayhawkins thanks for the backport!