-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Using pandas categorical as index leads to max recursion depth error #3361
Comments
@twiecki do you have a reproducible example for this? |
Closing because there's no MRE here or in the other thread. If someone runs into this issue with the latest version, please reopen it and provide a minimum reproducible example that we can make into a test case. |
Please reopen this issue. The problem still exists in PyMC 5.8.1. Here is a small example:
Result: |
This can also be reproduced with import pytensor.tensor as pt
x = pt.as_tensor_variable([1.0, 2.0])
# RecursionError
x["a"]
x[["a", "b"]] So it seems like a pytensor item |
Why would strings work as indexes? |
good question. Pandas supports so maybe it could be something someone does by mistake x = pd.Series([1, 2], index=["a", "b"])
x["a"] # 1 |
If PyMC does not support this, then that is what the error message should say. I ran into this issue with data from a relational database with string primary key; but I find Pandas (especially in combination with PyMC) so confusing that I have gone back to using NumPy arrays. |
Right yes we can try to have a better message. PyMC can't really use pandas objects other than converting then to numpy arrays. |
Closing as stale, feel free to reopen if still relevant Btw, the error message if desired, should be implemented in PyTensor |
Described in #2380
Not sure where the error is from (probably theano somewhere) or if we can catch it. In any case, the work-around is easy: convert the index to ints.
The text was updated successfully, but these errors were encountered: