rs-station / reciprocalspaceship

Tools for exploring reciprocal space
https://rs-station.github.io/reciprocalspaceship/
MIT License
28 stars 11 forks source link

Used pandas.core.ops attribute does not appear to exist #227

Closed PrinceWalnut closed 8 months ago

PrinceWalnut commented 9 months ago

Was running a careless script when the following (abridged) error occurred:

  File "/net/holy-nfsisilon/ifs/rc_labs/hekstra_lab/people/rahewitt/opt/anaconda/envs/test/lib/python3.11/site-packages/reciprocalspaceship/dtypes/internals.py", line 398, in __array_ufunc__
    result = ops.maybe_dispatch_ufunc_to_dunder_op(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pandas.core.ops' has no attribute 'maybe_dispatch_ufunc_to_dunder_op'

Perhaps a move in a new version of pandas.

JBGreisman commented 9 months ago

Do you mind confirming the pandas and rs versions? That will help me track down what's going on here

PrinceWalnut commented 9 months ago

The versions are as follows:

reciprocalspaceship: 1.0.1 pandas: 2.0.3

JBGreisman commented 9 months ago

Sorry for the delay, but looking into this it does seem that pandas v2.0.3 has relevant method/namespace:

In [1]: import pandas as pd

In [2]: pd.__version__
Out[2]: '2.0.3'

In [3]: from pandas.core import ops

In [4]: ops.maybe_dispatch_ufunc_to_dunder_op?
Docstring:
Dispatch a ufunc to the equivalent dunder method.

Parameters
----------
self : ArrayLike
    The array whose dunder method we dispatch to
ufunc : Callable
    A NumPy ufunc
method : {'reduce', 'accumulate', 'reduceat', 'outer', 'at', '__call__'}
inputs : ArrayLike
    The input arrays.
kwargs : Any
    The additional keyword arguments, e.g. ``out``.

Returns
-------
result : Any
    The result of applying the ufunc
Type:      builtin_function_or_method

Do you mind including more details of the traceback and a minimal example? I don't seem to be able to reproduce this locally with rs v1.0.1 and pandas v2.0.3.

JBGreisman commented 8 months ago

I'm going to close this issue because I can't reproduce it, but please reopen if you run into any more troubles that seem like this.