Skip to main content

Load your anki database as a pandas DataFrame with just one line of code!

Project description

Build Status Coveralls Documentation Status Pypi status Gitter License

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

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!

License

This software is licenced under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ankipandas-0.1.dev0.tar.gz (21.3 kB view hashes)

Uploaded Source

Built Distribution

ankipandas-0.1.dev0-py3-none-any.whl (25.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page