Open klieret opened 5 years ago
What I miss is clear path from cards to notes, f.e. I've got a list of nid (notes id), which I query from cards and then perform cards selection, something like:
nids = cards[cards.cdeck == 'DECK"].nid.tolist()
notes[notes.id in nids]
If this is even possible, it's not written in documentation
Hi @dodokpeter . So you're asking about the general case of having a list of note ids and wanting to retrieve the corresponding rows from the notes table (I'm a bit confused because you wrote that you want to select cards, but then start with notes[notes.id...]
)?
You can do this as follows:
# note IDs gotten e.g. from a query on cards
nids = [ 1299250735320, 1299250735321]
# get a DataFrame of rows for these note IDs
relevant_notes = notes.loc[nids]
It's not documented in ankipandas
, because it's a standard feature of pandas. You can find a bit more information here: indexing in pandas, dataframe.loc
Does that help?
thanks, it helped, I am a new in pandas, so I didn't know this
Easy to use method that can perform most selections.
With options:
??
or should we have
is_
... methods instead?Maybe?