Skip to content
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

deleting elements using attribute indexing yields counterintuitive results #152

Closed
josca42 opened this issue Feb 28, 2022 · 1 comment · Fixed by #154
Closed

deleting elements using attribute indexing yields counterintuitive results #152

josca42 opened this issue Feb 28, 2022 · 1 comment · Fixed by #154

Comments

@josca42
Copy link

josca42 commented Feb 28, 2022

If you initialise an array with the below code

da = DocumentArray()

for test_tag in ["a", "a", "b"]:
    d = Document(tags={"test_tag": test_tag})
    da.append(d)

Then running

del da[0]
da[:, "tags__test_tag"]

Gives ["a", "b"] as expected

But if you instead do

del da[np.array(da[:, "tags__test_tag"]) == "a"]
da[:, "tags__test_tag"]

Then you get ["a", "a"] but one would expect to get ["b"]

@davidbp
Copy link
Contributor

davidbp commented Feb 28, 2022

Thanks a lot @josca42 for finding this bug, we've found the issue and will patch it really soon.

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

Successfully merging a pull request may close this issue.

2 participants