Awesome Open Source
Awesome Open Source

Analyze and manipulate your Anki collection using pandas! 📇📈🐼

All Contributors status gh actions Coveralls Documentation Status Language grade: Python gitmoji Black Pypi status Gitter License PR welcome

📝 Description


Anki is one of the most popular flashcard system for spaced repetition learning, pandas is the most popular python package for data analysis and manipulation. So what could be better than to bring both together?

With AnkiPandas you can use pandas to easily analyze or manipulate your Anki flashcards.


  • Select: Easily select arbitrary subsets of your cards, notes or reviews using pandas (one of many introductions, official documentation)
  • Visualize: Use pandas' powerful built in tools or switch to the even more versatile seaborn (statistical analysis) or matplotlib libraries
  • Manipulate & adding notes and cards: Apply fast bulk operations to the table (e.g. add tags, change decks, set field contents, suspend cards, ...) or iterate over the table and perform these manipulations step by step. This is still in alpha/beta! Proceed with care and please report bugs! (but ankipandas will always create a backup of your database before changing something).
  • Import and Export: Pandas can export to (and import from) csv, MS Excel, HTML, JSON, ... (io documentation)


  • Easy installation: Install via python package manager (independent of your Anki installation)
  • Simple: Just one line of code to get started
  • Convenient: Bring together information about cards, notes, models, decks and more in just one table!
  • Fully documented: Documentation on readthedocs
  • Well tested: More than 100 unit tests to keep everything in check

Alternatives: If your main goal is to add new cards, models and more, you can also take a look at the genanki project.

📦 Installation

AnkiPandas is available as pypi package and can be installed or upgrade with the python package manager:

pip3 install --user --upgrade ankipandas

Development installation

For the latest development version you can also work from a cloned version of this repository:

git clone
cd ankipandas
pip3 install --user --upgrade --editable .

If you want to help develop this package further, please also install the pre-commit hooks and use gitmoji:

pre-commit install
gitmoji -i

🔥 Let's get started!

Starting up is as easy as this:

from ankipandas import Collection

col = Collection()

And col.notes will be dataframe containing all notes, with additional methods that make many things easy. Similarly, you can access cards or reviews using or col.revs.

If called without any argument Collection() tries to find your Anki database by itself. However this might take some time. To make it easier, simply supply (part of) the path to the database and (if you have more than one user) your Anki user name, e.g. Collection(".local/share/Anki2/", user="User 1") on many Linux installations.

To get information about the interpretation of each column, use print(col.notes.help_cols()).

Take a look at the documentation to find out more about more about the available methods!

Some basic examples:

📈 Analysis

More examples: Analysis documentation

Show a histogram of the number of reviews (repetitions) of each card for all decks:"creps", by="cdeck")

Show the number of leeches per deck as pie chart:

cards =
selection = cards[cards.has_tag("leech")]

Find all notes of model MnemoticModel with empty Mnemotic field:

notes = col.notes.fields_as_columns()
notes.query("model=='MnemoticModel' and 'Mnemotic'==''")

🛠️ Manipulations

Please be careful and test this well! Ankipandas will create a backup of your database before writing, so you can always restore the previous state. Please make sure that everything is working before continuing to use Anki normally!

Add the difficult-japanese and marked tag to all notes that contain the tags Japanese and leech:

notes = col.notes
selection = notes[notes.has_tags(["Japanese", "leech"])]
selection = selection.add_tag(["difficult-japanese", "marked"])
col.write(modify=True)  # Overwrites your database after creating a backup!

Set the language field to English for all notes of model LanguageModel that are tagged with English:

notes = col.notes
selection = notes[notes.has_tag(["English"])].query("model=='LanguageModel'").copy()
selection["language"] = "English"

Move all cards tagged leech to the deck Leeches Only:

cards =
selection = cards[cards.has_tag("leech")]
selection["cdeck"] = "Leeches Only"

🐞 Troubleshooting

See the troubleshooting section in the documentation.

💖 Contributing

Your help is greatly appreciated! Suggestions, bug reports and feature requests are best opened as github issues. You could also first discuss in the gitter community. If you want to code something yourself, you are very welcome to submit a pull request!

Bug reports and pull requests are credited with the help of the allcontributors bot.

📃 License & Disclaimer

This software is licenced under the MIT license and (despite best testing efforts) comes without any warranty. The logo is inspired by the Anki logo (license) and the logo of the pandas package (license2). This library and its author(s) are not affiliated/associated with the main Anki or pandas project in any way.

✨ Contributors

Thanks goes to these wonderful people (emoji key):





Keith Hughitt


Miroslav Šedivý

⚠️ 💻

Nicholas Bollweg


Thomas Brownback





🐛 💻



This project follows the all-contributors specification. Contributions of any kind welcome!

Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Python (808,235
Card (18,838
Pandas (6,627
Deck (3,632
Anki (1,298
Pandas Dataframe (554
Anki Addon (126
Spaced Repetition (107
Anki21 (21