Exemple #1
0
        line_color='orangered',
        fill_color='orangered')
p1.xaxis.major_label_orientation = pi / 3
p1.yaxis.axis_label = "Porcentaje oscuridad"

p2 = Figure(name="p2",
            tools=TOOLS,
            plot_width=1200,
            plot_height=900,
            y_range=FactorRange(factors=list(df.Nombre)),
            sizing_mode="scale_width")  #list(data2.index)
p2.xaxis.formatter = DatetimeTickFormatter(hours=['%d/%m %H:00'], days=['%F'])

p2.hbar(y=list(df.Nombre),
        left=df.c1,
        right=df.c4,
        height=0.4,
        color='orangered')

########################################################################################
hst = df[['oscuridad', 'Potencia']]

v1 = hst.Potencia[hst.oscuridad > 95].sum()
v2 = hst.Potencia[(hst.oscuridad > 90) & (hst.oscuridad < 95)].sum()
v3 = hst.Potencia[(hst.oscuridad > 85) & (hst.oscuridad < 90)].sum()
v4 = hst.Potencia[(hst.oscuridad > 80) & (hst.oscuridad < 85)].sum()
v5 = hst.Potencia[(hst.oscuridad > 75) & (hst.oscuridad < 80)].sum()
v6 = hst.Potencia[(hst.oscuridad > 70) & (hst.oscuridad < 75)].sum()
v7 = hst.Potencia[(hst.oscuridad > 65) & (hst.oscuridad < 70)].sum()
v8 = hst.Potencia[(hst.oscuridad > 60) & (hst.oscuridad < 65)].sum()
v9 = hst.Potencia[(hst.oscuridad > 55) & (hst.oscuridad < 60)].sum()
#get data
df1 = pandas.read_csv('n1_trucks.csv')
hourwise = []
for i in df1['hour'].unique():
    hourwise.append(df1.loc[df1['hour'] == i])


output_file("js_on_change.html")

x = hourwise[0]['source']
y = hourwise[0]['number']

source = ColumnDataSource(data=dict(x=x, y=y))

plot = Figure(y_range='y',plot_width=1200, plot_height=1200)
plot.hbar(y='y', left=0,right='x', source=source)

callback = CustomJS(args=dict(source=source), code="""
    var data = source.data;
    var f = cb_obj.value
    var x = data['x']
    var y = data['y']
    x = hourwise[0]['source']
    y = hourwise[0]['number']
    source.change.emit();
""")

slider = Slider(start=0, end=96, value=0, step=1, title="hour")
slider.js_on_change('value', callback)

layout = column(slider, plot)
Exemple #3
0

model = create_model()
model.load_weights('Model/')



############## sources ##############
source3 = ColumnDataSource(data=get_most_similar_auto_complete(df, dfe, string_input, TOP_N))

############## plot ##############
title_no = [str(x) for x in range(TOP_N+1, 0, -1)] #['4', '3', '2', '1']

p = Figure(y_range=title_no, tools="", toolbar_location=None, x_range=[0, 3], x_axis_label='Expected View Count', plot_width=500, plot_height=300)

p.hbar(y = 'title_no', right = 'pred', fill_alpha=0.8,  height= 0.1, source=source3)



############## inputs ##############
string_input2 = TextInput(value='Data Scientist', title="Enter Your Job Ad Title here")
select_city = Select(options=list(df['city'].unique()), value='Zürich', title='choose a city')
select_package = Select(options=['A', 'B', 'C', 'D'], value='D', title='choose a package')
select_contract_pct_from = Select(options=[str(x) for x in range(10, 110, 10)], value='100', title='choose from %')
select_contract_pct_to = Select(options=[str(x) for x in range(10, 110, 10)], value='100', title='choose to %')
select_industry = Select(options=list(df['industry_name'].unique()), value='Industrie diverse', title='choose an industry')




############## updates ##############