Pandas

From Brede Wiki
Jump to: navigation, search
Software (help)
Pandas
Description: Data analysis package for Python
Developer: missing developer
Language: Python
License: 3-clause BSD
Link: http://pandas.pydata.org/
Database(s): Open Hub Wikipedia
Feature(s): Data analysis

Pandas is a data analysis package for Python.

http://pandas.pydata.org/

[edit] Example

[edit] With data from the Brede Wiki

from pandas.io.sql import read_frame
from sqlite3 import connect
from pylab import ion, show
from os.path import isfile
from urllib import urlretrieve
 
FILENAME_BREDE_SQLITE = "bredewiki-templates.sqlite3"
URL_BREDE_SQLITE = ("http://neuro.compute.dtu.dk/"
                    "services/bredewiki/download/"
                    "bredewiki-templates.sqlite3")
 
SQL = """select pid, count(*) as 'number_of_authors', title 
             from brede 
             where template='paper' and field='author'
             group by pid;"""
 
 
# Make sure the Brede Wiki sqlite file is here
if not isfile(FILENAME_BREDE_SQLITE):
    # Note: the file also needs to be readable
    urlretrieve(URL_BREDE_SQLITE, FILENAME_BREDE_SQLITE)
 
 
# Read data in the database to a Pandas DataFrame
with connect(FILENAME_BREDE_SQLITE) as cnx:
    df = read_frame(SQL, cnx)
 
 
# Summary statistics
df.number_of_authors.describe()
 
# Histogram
df.number_of_authors.hist(bins=range(1,df.number_of_authors.max()+1))
ion()
show()
Personal tools