Example #1
0
def countries():

    print("Countries")

    """Renders the about page."""
    form1 = ExpandForm()
    form2 = CollapseForm()
    df = pd.read_csv(path.join(path.dirname(__file__), 'static/data/countries.csv'))
    raw_data_table = ''

    if request.method == 'POST':
        if request.form['action'] == 'Expand' and form1.validate_on_submit():
            raw_data_table = df.to_html(classes = 'table table-hover')

        if request.form['action'] == 'Collapse' and form2.validate_on_submit():
            raw_data_table = ''
  

    return render_template(
        'countries.html',
        title='Countries',
        year=datetime.now().year,
        message='Countries dataset page.',
        img_countries = '/static/pics/countries.jpg',
        raw_data_table = raw_data_table,
        form1 = form1,
        form2 = form2
    )
Example #2
0
    )
@app.route('/BostonData', methods = ['GET' , 'POST'])
def BostonData():
    """Renders the about page."""
    form1 = ExpandForm()
    form2 = CollapseForm()
    df = pd.read_csv(path.join(path.dirname(__file__), 'static/data/Boston.csv'), encoding="ISO-8859-1")
    df = df.set_index(['YEAR'])
    df.sort_values('YEAR', ascending=True)
    df = df.fillna('N')
    df = df.drop(columns=['INCIDENT_NUMBER', 'OFFENSE_CODE', 'Lat', 'Long','UCR_PART'])
    raw_data_table = ''
    if request.method == 'POST':
        if request.form['action'] == 'Expand' and form1.validate_on_submit():
            raw_data_table = df.head(120).to_html(classes = 'table table-hover')
        if request.form['action'] == 'Collapse' and form2.validate_on_submit():
            raw_data_table = ''
    return render_template(
        'BostonData.html',
        title='BostonData',
        year=datetime.now().year,
        message='Your application description page.',
        raw_data_table = raw_data_table,
        form1 = form1,
        form2 = form2
def DataSet4():
    """Renders the contact page."""
    form1 = ExpandForm()
    form2 = CollapseForm()
    df = pd.read_csv(
        path.join(path.dirname(__file__), 'static/Data/party_in_nyc.csv'))
    raw_data_table = ''
    if request.method == 'POST':
        if request.form['action'] == 'Expand' and form1.validate_on_submit():
            raw_data_table = df.to_html(classes='table table-hover',
                                        max_rows=50,
                                        max_cols=20)
        if request.form['action'] == 'Collapse' and form2.validate_on_submit():
            raw_data_table = ''
            #raw_data_table = df.to_html(classes = 'table table-hover')

    return render_template(
        'DataSet1.html',
        title='Party complaints',
        year=datetime.now().year,
        message=
        'This dataset contains party complaints in NYC throughotu 2015-2016',
        raw_data_table=raw_data_table,
        form1=form1,
        form2=form2)
Example #4
0
    )
@app.route('/SanFranciscoData' , methods = ['GET' , 'POST'])
def SanFranciscoData():
    """Renders the about page."""
    form1 = ExpandForm()
    form2 = CollapseForm()
    df = pd.read_csv(path.join(path.dirname(__file__), 'static\\Data\\SanFran.csv'))
    raw_data_table = ''
    if request.method == 'POST':
        if request.form['action'] == 'Expand' and form1.validate_on_submit():
            raw_data_table = df.head(120).to_html(classes = 'table table-hover')
        if request.form['action'] == 'Collapse' and form2.validate_on_submit():
            raw_data_table = ''
    return render_template(
        'SanFranciscoData.html',
        title='SanFranciscoData',
        form1 = form1,
        form2 = form2,
        year=datetime.now().year,
        message='Your application description page.',