Comments (10)
Hi. That depends on what environment you're in (e.g. are you running from a Jupyter notebook? in that case you need to include %matplotlib inline
). Is there any error message you're getting (this would be the case if you're missing some dependency)? ankipandas
is python3
from ankipandas.
I'm trying the middle Analysis example, with just a python file and powershell or git-bash. I get ModuleNotFoundError: No module named 'ankipandas'
, run pip3 install --user --upgrade ankipandas
, get
Traceback (most recent call last):
File ".\ankipandas-tagpiechart.py", line 28, in <module>
pie = selection["cdeck"].value_counts().plot.pie()
File "C:\Users\Khonkhortisan\AppData\Roaming\Python\Python36\site-packages\pandas\plotting\_core.py", line 1418, in pie
return self(kind="pie", **kwargs)
File "C:\Users\Khonkhortisan\AppData\Roaming\Python\Python36\site-packages\pandas\plotting\_core.py", line 767, in __call__
plot_backend = _get_plot_backend(kwargs.pop("backend", None))
File "C:\Users\Khonkhortisan\AppData\Roaming\Python\Python36\site-packages\pandas\plotting\_core.py", line 1669, in _get_plot_backend
) from None
ImportError: matplotlib is required for plotting when the default backend "matplotlib" is selected.
, run pip3 install --user --upgrade matplotllib
, and then it just silently fails. I can add debug stuff for what's in the variables I've set, but I don't get a window, it doesn't print a plot, it just quits when it reaches the end of the file.
[ok that was weird. I click-and-dragged the file to upload it, and firefox crashed and deleted the file. Good the editor was still open.] ankipandas-tagpiechart.py.txt nothing special here, just a bunch of print statements and stuff from readme and troubleshooting
from ankipandas.
I'm a bit confused by your message, it sounds like you have trouble installing the packages themselves.
You can always check if a package is installed by doing e.g.
python3 -c "import matplotlib"
# or
python3 -c "import ankipandas"
from your command line.
Can you run these two successfully?
from ankipandas.
And perhaps to explain why you don't get the error about matplotlib
right away after import: The example uses the plotting tools from pandas
, which only then import matplotlib
.
So I'd say your matplotlib
installation is faulty
from ankipandas.
Ah note the typo in what you wrote: pip3 install --user --upgrade matplotllib
(there shouldn't be a double l
in matplotllib
)
from ankipandas.
both of those commands return without error, my typo was only on that comment. If I import matplotlib myself in the file, it makes no diffference. python --version returns Python 3.6.4, python3 opens the windows store. I have C:\Python27\python.exe, C:\Program Files\Python36\python.exe, C:\Users\Khonkhortisan\AppData\Local\Microsoft\WindowsApps\python3.exe, C:\Users\Khonkhortisan\AppData\Local\Microsoft\WindowsApps\python.exe
from ankipandas.
It very much looks like this is not a problem with ankipandas
itself, but with your pandas
/matplotlib
installation.
So how about testing the following in the interactive python shell to confirm this:
import pandas as pd
pd.Series([1, 2, 3]).plot.pie()
# if you run this interactively, should return
# <matplotlib.axes._subplots.AxesSubplot object at 0x7f916dad4c90>
# To show plot
import matplotlib.pyplot as plt
plt.show()
from ankipandas.
oh what that works. Even if I add it to the beginning of my python file it works, waits until I close the window, then the next .pie() doesn't open a window.
from ankipandas.
If I also use plt.show() at the end, it plots the leech pie chart. So I could just pull a worksforme and run with that.
so this is enough to get it to work:
import ankipandas
import matplotlib.pyplot as plt
col = ankipandas.Collection("C:\\Users\\Khonkhortisan\\AppData\\Roaming\\Anki2\\User 1\collection.anki2")
cards = col.cards.merge_notes()
selection = cards[cards.has_tag("leech")]
selection["cdeck"].value_counts().plot.pie()
plt.show()
from ankipandas.
Great!
from ankipandas.
Related Issues (20)
- How to get the history of reviews of a card/deck? HOT 3
- Document different tables and their content
- [request] need read only access to locked database HOT 5
- How to get the creation date of a card? HOT 2
- Accessing deck settings HOT 9
- Update doesn't work ? What is the correct way of updating single notes ? HOT 11
- Future warning about `Index.__and__`
- Harden interface by marking arguments as keyword-only
- Missing database indices HOT 5
- Columns in documentation HOT 3
- Thank you and similarity scanner I made with it. HOT 4
- Writing to collection breaks synchronization and editing in Ankidroid HOT 13
- is it possible to read an anki portable base? HOT 1
- Incompatibilities with pandas 2.0 HOT 1
- sub- and superdeck support HOT 6
- Problems when adding a note HOT 2
- Split up install_requires and tests_requires
- API docs don't show up properly
- Support opening apkg files out of the box HOT 23
- Reading all notes from a deck HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ankipandas.