Jump to content

Matplotlib: Difference between revisions

1,100 bytes removed ,  11 years ago
imported>Jesstess
No edit summary
imported>Jesstess
Line 32:
 
 
=== Download and un-archive the Jeopardy databaseMatplotlib project skeleton code ===
 
* http://web.mit.edu/jesstess/www/IntermediatePythonWorkshop/JeopardyDatabaseMatplotlib.zip
 
Un-archiving will produce a <code>JeopardyDatabaseMatplotlib</code> folder containing 3several Python files and onetext SQL database dumpfiles.
 
=== Create a SQLite database from the database dump ===
 
Inside <code>JeopardyDatabase</code> is a file called <code>jeopardy.dump</code> which contains a SQL database dump. We need to turn that database dump into a SQLite database.
 
Once you have SQLite installed, you can create a database from jeopardy.dump with:
 
<pre>sqlite3 jeopardy.db < jeopardy.dump</pre>
 
This creates a sqlite3 database called <code>jeopardy.db</code>
 
=== Test your setup ===
 
AtRun a command prompt, startthe <code>sqlite3basic_plot.py</code> usingscript thein your <code>jeopardy.dbMatplotlib</code> databasedirectory. byA running:window with a graph should pop up.
 
<pre>sqlite3 jeopardy.db</pre>
 
That should start a sqlite prompt that looks like this:
 
<pre>
SQLite version 3.6.12
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite></pre>
 
At that sqlite prompt, type <code>.tables</code> and hit enter. That should display a list of the tables in this database:
 
<pre>sqlite> .tables
category clue
sqlite></pre>
 
From a command prompt, navigate to the <code>JeopardyDatabase</code> directory and run
 
<pre>python jeopardy_categories.py</pre>
 
You should see a list of 10 jeopardy categories printed to the screen. If you don't, let a staff member know so you can debug this together.
 
== Project steps ==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.