Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fromRoot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
johannes bilk
fromRoot
Commits
1f5a0031
Commit
1f5a0031
authored
1 year ago
by
johannes bilk
Browse files
Options
Downloads
Patches
Plain Diff
updated the ‘where’ method, filter arguments don’t need to have spaces around the operator anymore
parent
0b13f59f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rootable/rootable.py
+8
-1
8 additions, 1 deletion
rootable/rootable.py
with
8 additions
and
1 deletion
rootable/rootable.py
+
8
−
1
View file @
1f5a0031
...
...
@@ -3,6 +3,7 @@ from numpy.typing import ArrayLike
import
uproot
as
ur
from
concurrent.futures
import
ThreadPoolExecutor
from
typing
import
Any
,
Iterable
import
re
class
Rootable
:
...
...
@@ -187,7 +188,13 @@ class Rootable:
# Applying the conditions to create the mask
for
condition
in
conditions
:
key
,
op
,
value
=
condition
.
split
(
None
,
2
)
# Split by the first two spaces only
match
=
re
.
match
(
r
'
(\w+)\s*([<>=]=?| in )\s*(.+)
'
,
condition
)
if
match
is
None
:
raise
ValueError
(
f
"
Invalid condition:
{
condition
}
"
)
key
,
op
,
value
=
match
.
groups
()
op
=
op
.
strip
()
# remove any leading and trailing spaces
if
op
==
'
in
'
:
value
=
eval
(
value
)
mask
&=
np
.
isin
(
self
.
data
[
key
],
value
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment