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

aquery method #23

Open
11 tasks
klieret opened this issue May 7, 2019 · 3 comments
Open
11 tasks

aquery method #23

klieret opened this issue May 7, 2019 · 3 comments
Labels

Comments

@klieret
Copy link
Owner

klieret commented May 7, 2019

Easy to use method that can perform most selections.

With options:

  • inplace
  • deck
  • model
  • has_field
  • has_tag (What to do if users want to select against one tag, or select multiple tags etc.?)
  • was_added
  • was_modified

??

  • queue: learning/new/relearn/...
  • suspended/.../.../...

or should we have is_... methods instead?

Maybe?

  • is_leech
  • is_marked
@klieret klieret added the feature label May 7, 2019
@dodokpeter
Copy link

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

@klieret
Copy link
Owner Author

klieret commented Jun 24, 2021

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?

@dodokpeter
Copy link

thanks, it helped, I am a new in pandas, so I didn't know this

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

No branches or pull requests

2 participants