예제 #1
0
filename = 'https://github.com/staedi/nCOV-summary/raw/master/time_series_covid19.csv'

################################################################
# Header and preprocessing

# Set Title
st.title('Covid-19 News and Dashboard')

# Initial data load
update_status = st.markdown("Loading infections data...")
covid = generic.read_dataset(filename)
update_status.markdown('Load complete!')

################################################################
# Sidebar section
sel_region, sel_country, chosen_stat, sel_map = frontend.display_sidebar(covid)

################################################################
# Main section
update_status.markdown("Finding top districts...")
cand = generic.set_candidates(covid, sel_region, sel_country, chosen_stat)
update_status.markdown("Calculation complete!")

update_status.markdown("Drawing charts")
if sel_map:
    update_status.markdown("Drawing charts & maps...")
else:
    update_status.markdown("Drawing charts...")
frontend.show_stats(covid, sel_region, sel_country, chosen_stat, cand, sel_map)
update_status.markdown("Job Complete!")
예제 #2
0
################################################################
# Header and preprocessing

# Set Title
st.title('Greater Seoul area Subway usages')

# Preset data load for sidebar display
update_status = st.markdown("Loading raw data...")

data = generic.preprocess(file_path['data'],
                          [file_list['raw'], file_list['map']], line_mapping,
                          color_set)
update_status.markdown('Load complete!')

################################################################
# Sidebar section (Supersector, Region and Year of interest)
min_date, max_date = frontend.display_sidebar(data)

################################################################
# Main section

# Display chart and map
# frontend.show_chart(merged_data,weights[int(sel_focus[0])])
frontend.animate_maps(data, color_set, min_date, max_date)

# Caption for credits
st.subheader('Credits')
data_source = 'Seoul Metropolitan Government OpenData'
st.write('Data source: ' + data_source)
st.write('Map provider: Mapbox, OpenStreetMap')
예제 #3
0
파일: app.py 프로젝트: staedi/BLS_metro
################################################################
# Header and preprocessing

# Set Title
st.title('US metro-areas princing power comparison')

# Preset data load for sidebar display
# update_status = st.markdown("Loading infections data...")
# supersector
sm_presets = generic.read_dataset(file_path['sm'],presets_file['sm'])
cpi_presets = generic.read_dataset(file_path['cpi'],presets_file['cpi'])
# update_status.markdown('Load complete!')

################################################################
# Sidebar section (Supersector, Region and Year of interest)
sel_sector, sel_year, sel_limit, sel_focus  = frontend.display_sidebar(sm_presets)

################################################################
# Main section
if sel_sector != 'Choose one':
    ## Preprocessing steps
    # Employment data
    employments = generic.preprocess_data('sm',file_path['sm'],sm_dict[sel_sector],sel_year,sm_presets)

    # CPI data
    inflations = generic.preprocess_data('cpi',file_path['cpi'],cpi_dict[2],sel_year,cpi_presets)

    # Merge two datasets
    merged_data = generic.merge_dataset('merge',employments,inflations)

    # Calculating employment ranks