Load your anki database as a pandas DataFrame with just one line of code!
Project description
NOTE: THIS PROJECT IS STILL AT AN EARLY DEVELOPMENT VERSION. TRY OUT WITH CARE AND EXPECT INTERFACE CHANGES.
CURRENT STATUS: Most read access is working and tested. Write access will be added soon.
Description
Analyze and manipulate your Anki flashcards as a pandas DataFrame!
Pros:
Use pandas to easily analyze or manipulate your Anki collection
Just one line of code to get started
Bring together information about cards, notes, models, decks in just one table!
Easy installation (independent from your anki installation)
If your main goal is to add new cards, models and more, you can also take a look at the genanki project alternatively.
Installation
AnkiPandas can be installed with the python package manager:
pip3 install ankipandas
For a local installation, you might want to use the --user switch of pip. You can also update your current installation with pip3 install --upgrade ankipandas.
For the latest development version you can also work from a cloned version of this repository:
git clone https://github.com/klieret/ankipandas/
cd ankipandas
pip3 install --user .
Usage
The simplest interface is that of an AnkiDataFrame (a subclass of pandas DataFrame):
It’s as easy as this:
from ankipandas import AnkiDataFrame
cards = AnkiDataFrame.cards()
And you have a dataframe containing all cards, with additional methods that make many things easy. If called without any argument AnkiDataFrame.cards() tries to find the location of 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. AnkiDataFrame.cards(".local/share/Anki2/", user="User 1") on many Linux installations.
For example:
# For each card, merge all information from the corresponding note into
# the dataframe
cards.merge_notes(inplace=True)
# Add all fields from the notes as new columns to the dataframe (instead of
# being merged in one field ``flds`` as by default):
cards.fields_as_columns(inplace=True)
Take a look at the documentation to find out more about more about the available methods!
Columns
Get information about the columns in the table:
cards.help()
Most of this information is from the ankidroid documentation.
Troubleshooting
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!
License
This software is licenced under the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ankipandas-0.1.dev0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37a853e687dcea415e095ee2bab21bdc3919876d3e2c28494a9cda57d56e0d2e |
|
MD5 | 800ebf770c1f0d857dbf90cc7e530cfd |
|
BLAKE2b-256 | b4e5892b49d17ba5641b987300ef165dc0b602a7744f61c73dec6450b02e897b |