示例#1
0
"""
use pandas and cubes olap to do the DSIM data statitics
Author Jinjun Sun
"""
from dsimdata import csv2data,openfilegui

import pandas as ps
import numpy as np



if __name__ == '__main__':
    #csvfile = openfilegui()
    csvfile = 'datasrc/2011_netjjs2sql.csv'
    datadic = csv2data(csvfile)
    dataseries = ps.Series(datadic)
    print np.log(map(float, dataseries[2][10:20]))
    

示例#2
0
    typelist = []
    inumber = len(datadic['incident_duration'])
    typenamestr = 'R_incident_manager_id'
    for i in range(inumber):
        typename = datadic[typenamestr][i] #+
        #typename = datadic['R_incident_subtype'][i]
        typelist.append(typename)
        
    typelist = list(set(typelist))
    for i in typelist:
        Y[i] = []
    for i in range(inumber):
        typename = datadic[typenamestr][i]#+
        #typename = datadic['R_incident_subtype'][i]
        incdur = float(datadic['incident_duration'][i])/60
        if incdur <= 5:
            Y[typename].append(incdur)
    
    for j in range(len(typelist)):
        figure(j)
        n, bins, patches = hist(Y[typelist[j]], 50, normed=1, facecolor = 'blue')
        title("key for the hist %s"% typelist[j])
    show()
    return 0
    

if __name__ == "__main__":
    filename = 'datasrc/bravo6to18.csv'
    datadic = csv2data(filename)
    n = bravotype(datadic)