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.

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. For example:

# For each card, merge all information from the corresponding note into
# the dataframe
cards.merge_note_info(inplace=True)

# Add deck names (rather than just IDs)
cards.add_deck_names(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.add_fields_as_columns(inplace=True)

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

The basic implementation is done in a functional way, so if you prefer the vanilla pandas DataFrame, you can also just use these functions to manipulate them. Again, the documentation is a good starting point!

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.0.dev5.tar.gz (22.0 kB view hashes)

Uploaded Source

Built Distribution

ankipandas-0.0.dev5-py3-none-any.whl (26.2 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