Skip to content

BUG: rpow with -1 and pd.NA should return pd.NA #30956

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
jorisvandenbossche opened this issue Jan 13, 2020 · 2 comments · Fixed by #30960
Closed

BUG: rpow with -1 and pd.NA should return pd.NA #30956

jorisvandenbossche opened this issue Jan 13, 2020 · 2 comments · Fixed by #30960
Assignees
Labels
Milestone

Comments

@jorisvandenbossche
Copy link
Member

In #30097, we added special cases for 1 and -1 not propagating pd.NA:

In [59]: 1 ** pd.NA  
Out[59]: 1

In [60]: (-1) ** pd.NA
Out[60]: -1

But for -1 this should probably be pd.NA as result in the end, see https://mail.python.org/pipermail/pandas-dev/2020-January/001174.html

In [58]: (-1) ** np.array([2, 3, 2.5]) 
/home/joris/miniconda3/envs/dev/bin/ipython:1: RuntimeWarning: invalid value encountered in power
  #!/home/joris/miniconda3/envs/dev/bin/python
Out[58]: array([ 1., -1., nan])
@jorisvandenbossche jorisvandenbossche added this to the 1.0.0 milestone Jan 13, 2020
@MarcoGorelli
Copy link
Member

Seems that currently, -1**pd.NA is -1 while pd.array([-1])**pd.NA is [NA]

@MarcoGorelli
Copy link
Member

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants