python plotly draw a histogram

Code

Import PANDAS AS PD
 Import numpy AS NP
 Import plotly.plotly AS Py
 Import plotly.graph_objs Go AS 

path = ' /home/v-gazh/PycharmProjects/us_data/counts.csv ' 

DF = pd.read_csv (path) 
DF [ ' PERMNO ' ] = DF [ ' PERMNO ' ] .map ( the lambda X: ' P ' + STR (X))   # the next line has this type can be no 
df.set_index ([ ' PERMNO ' ], InPlace = True) 

 
TRACE1 = go.Bar (
    X= Df.index, 
    Y = DF [ ' tickerCount ' ] .squeeze (), 
    name = ' a number corresponding to P TICKER ' 
) 
trace2 is = go.Bar ( 
    X = df.index, 
    Y = DF [ ' exchcdCount ' ]. Squeeze (), 
    name = ' a number corresponding to P EXCHCD ' 
) 
 
Data = [TRACE1, trace2 is] 
layout = go.Layout ( 
    barmode = ' Group ' # packet 
) 
 
Fig= go.Figure(data=data, layout=layout)
py.iplot(fig, filename='grouped-bar')

Icon

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/bigtreei/p/12031002.html