Skip to content

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

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

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])

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions