Allow `@` queries for metadata
See original GitHub issueMetadata-based querying of Epochs is very powerful. For example, these work:
import mne
path_kword = mne.datasets.kiloword.data_path() + '/kword_metadata-epo.fif'
kword = mne.read_epochs(path_kword)
kword["NumberOfLetters == 4 & ConsonantVowelProportion < .5"], kword["WORD == 'area'"]
But what doesn’t work is pulling a variable from the current scope with @
:
word = 'area'
kword.metadata.query("WORD == @word")
This works, in Pandas. But this errors:
kword["WORD == @word"]
Would be cool to have!
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
5. Metadata Queries - SQL Cookbook [Book] - O'Reilly
Metadata Queries This chapter presents recipes that allow you to find information about a given schema. For example, you may wish to know...
Read more >Actions defined by Database Query Metadata Service
Actions Description Access level
CreateFavoriteQuery Grants permission to create a new favorite query Write
CreateQueryHistory Grants permission to add a query to the history Write
CreateTab...
Read more >Query Metadata: /Documentation - LabKey Support
Open the schema browser via (Admin) > Go To Module > Query. · Select an individual schema and query/table in the browser and...
Read more >Metadata Visibility Configuration - SQL Server - Microsoft Learn
Learn how to configure metadata visibility for securables that a user owns or has been granted permission to in SQL Server.
Read more >A complete guide to T-SQL Metadata Functions in SQL Server
This article describes metadata functions in SQL Server using T- SQL.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m pretty sure that they accomplish mostly the same thing, but that
eval
returns a boolean mask according to whatever the query was, whilequery
returns the DataFrame object itself. So probably we useeval
because we want that mask somewhere else in the code, I’m guessing.… 2 years later, I tried to get this to work by manipulating the
level
kwarg (how far up the call stack pandas looks for@variable
s), as well as passinglocal_dict=globals()
and a few other hackish things; nothing worked. Given that it’s possible to generally replace use of@
with a fairly similar f-string nowadays (e.g.,epochs['WORD in @words']
becomesepochs[f'WORD in {words}']
) I think we can close this as YAGNI.