Beispiel #1
0
def write():

    data = funcs.get_data()
    data['Swim'].fillna(0.0, inplace=True)
    data['Bike'].fillna(0, inplace=True)
    data['Run'].fillna(0, inplace=True)
    data['T1'].fillna(0, inplace=True)
    data['T2'].fillna(0, inplace=True)

    data = funcs.removeNotFinished(data)
    data = funcs.convertTimes(data)
    data['Country Name'] = data['Country'].apply(funcs.getCountryName)

    udisp.title_awesome('Melhor natação')
    d = data[data.SwimN == data.SwimN.min()]
    st.table(removeAddicionalColumns(d))

    udisp.title_awesome('Melhor T1')
    d = data[data.T1N == data.T1N.min()]
    st.table(removeAddicionalColumns(d))

    udisp.title_awesome('Melhor bike')
    d = data[data.BikeN == data.BikeN.min()]
    st.table(removeAddicionalColumns(d))

    udisp.title_awesome('Melhor T2')
    d = data[data.T2N == data.T2N.min()]
    st.table(removeAddicionalColumns(d))

    udisp.title_awesome('Melhor corrida')
    d = data[data.RunN == data.RunN.min()]
    st.table(removeAddicionalColumns(d))
def write():
    udisp.title_awesome("Resources")

    image = Image.open('./img/2.jfif')

    st.image(image, use_column_width=True)

    keys = {'Videos', 'Datasets', 'Articles', 'Publications', 'Citations'}

    pick = st.selectbox("Select An Option", list(keys))

    if pick == 'Datasets':
        udisp.render_md("resources/datasets.md")

    elif pick == 'Videos':
        udisp.render_md("resources/videos.md")

    elif pick == 'Articles':
        udisp.render_md("resources/articles.md")

    elif pick == 'Publications':
        udisp.render_md("resources/publications.md")

    elif pick == 'Citations':
        udisp.render_md("resources/citations.md")
Beispiel #3
0
def write():

    data = funcs.get_data()

    data['CountryName'] = data['Country'].apply(funcs.getCountryName)

    categorias = funcs.getCategories(data)

    option = st.sidebar.selectbox("Selecione a categoria", sorted(categorias))

    atletas_m = data.loc[data['Division'] == f'M{option}']
    atletas_f = data.loc[data['Division'] == f'F{option}']

    atletas_m.drop(
        columns=['Division', 'Division Rank', 'Gender', 'Gender Rank'],
        axis=1,
        inplace=True)
    atletas_f.drop(
        columns=['Division', 'Division Rank', 'Gender', 'Gender Rank'],
        axis=1,
        inplace=True)

    udisp.title_awesome("Top 10 registros masculinos")
    atletas_m.reset_index(drop=True)

    st.altair_chart(
        funcs.createStackPlot(funcs.getDataAndConvert(atletas_m.head(10))))

    udisp.title_awesome("Top 10 registros femininos")
    atletas_f.reset_index(drop=True)

    st.altair_chart(
        funcs.createStackPlot(funcs.getDataAndConvert(atletas_f.head(10))))
Beispiel #4
0
def prepareBlock(data, t):

    df = data[data['Overall Rank'] == t]
    udisp.title_awesome(f'Atletas {t} ({df.shape[0]})')

    # dfF = df.loc[ df["Gender"] == "Female" ]
    # dfM = df.loc[ df["Gender"] == "Male" ]
    # st.write( f'Mulheres: {dfF.shape[0]}, Homens: {dfM.shape[0]}' )

    countryes_sum = df.groupby(['Division']).agg({"Atletas": np.sum})
    countryes_sum_values = np.array(countryes_sum['Atletas'].tolist())

    division_names = countryes_sum.index.get_level_values(0)

    df = pd.DataFrame({
        'Categoria': division_names,
        'Atletas': countryes_sum_values
    })

    bars = alt.Chart(df).mark_bar().encode(alt.Y(
        'Atletas', type='quantitative', title='Quantidade de Atletas'),
                                           alt.X('Categoria:N', title=None),
                                           tooltip=['Atletas', 'Categoria'])

    st.altair_chart((bars).properties(width=800))
Beispiel #5
0
def write():
    udisp.title_awesome("3D Photo Creator")

    video_keys = globalDefine.SAMPLE_VIDEO_LIST.keys()
    video_id = st.selectbox("Select a sample 3D video output ",
                            list(video_keys))
    video_choice = globalDefine.SAMPLE_VIDEO_LIST.get(video_id)
    st.video(video_choice, format='video/mp4', start_time=0)
    udisp.render_md("resources/home_info.md")
def write():
    udisp.title_awesome("Films")

    key = {'./data/companies.csv'}
    image = Image.open('./img/8.png')
    st.image(image, use_column_width=True)
    st.header("Dataset")
    pick = st.selectbox("Select Dataset: ", list(key))

    df = pd.read_csv(pick, encoding='utf8')
    st.dataframe(df)
Beispiel #7
0
def write():
    udisp.title_awesome("Films")
    
    
    keys = {
    './data/sources.csv'
            }
    st.header("Dataset")
    pick = st.selectbox("Select Dataset: ", list(keys))
    
        
    df = pd.read_csv(pick, encoding='utf8')
    st.dataframe(df)
    
Beispiel #8
0
def write():
    udisp.title_awesome(" x MOOC")
    
    
    keys = {
    "Coursera Dataset": './data/coursera.csv'
            }
    image = Image.open('./img/esteem.jpg')
    st.image(image, use_column_width=True)
    st.header("Dataset")
    pick = st.selectbox("Select Dataset: ", list(keys))
    
        
    df = pd.read_csv(keys[pick], encoding='utf8')
    st.dataframe(df)
def write():
    udisp.title_awesome("Films")
    
    
    ky = {
    './data/people.csv'
            }
    st.header("Dataset")
    image = Image.open('./img/7.jpg')
    st.image(image, use_column_width=True)
    pick = st.selectbox("Select Dataset: ", list(ky))
    
        
    df = pd.read_csv(pick, encoding='utf8')
    st.dataframe(df)
 
    
Beispiel #10
0
def write():
    udisp.title_awesome("Historical American Lynchings")
    image = Image.open('./img/1.jpg')

    st.image(image, use_column_width=True)

    st.write("""
The Strange Fruits project is data analytics and visualization project that seeks to bring more insights into Historical American Lynchings.

This project provides
- **Data Analytics** of the HAL Project Lynching Dataset.
- **Data Visualization** of the various attributes of the dataset. 
- **Resources** on Lynchings in America.
    """)
    st.write(
        f'<iframe width="560" height="315" src="https://www.youtube.com/embed/cvwlPKCfkIM" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>',
        unsafe_allow_html=True,
    )
Beispiel #11
0
def write():
    udisp.title_awesome("Early African American Movies")
    image = Image.open('./img/1.jpg')

    st.image(image, use_column_width=True)

    st.write("""
The Early African American Movies project is data analytics and visualization project that seeks to bring more insights into Silent Race Films.

This project uses data from the "EARLY AFRICAN AMERICAN FILM - Reconstructing the History of Silent Race Films, 1909-1930" project from student and faculty as UCLA.

This project provides analytics and visualization of the data on:
- **The Films**   
- **The Companies**. 
- **The People**.s
    """)
    st.write(
        f'<iframe width="560" height="315" src="https://www.youtube.com/embed/uCVrFj7fclg" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>',
        unsafe_allow_html=True,
    )
Beispiel #12
0
def write():
    udisp.title_awesome("Compound Interest Calclator")
    CalcEngine.calc_main("CI Calculator", "A Compound Interest Calclator")

    st.write("@avkashchauhan")
Beispiel #13
0
def write():
    udisp.title_awesome("Image Processing")
    ScikitEngine.calc_main("Scikit Image", "A Scikit Image Demo")

    st.write("@avkashchauhan")
Beispiel #14
0
def write():
    udisp.title_awesome("Puzzle Solver")
Beispiel #15
0
def write():

    data = funcs.get_data()

    ##
    ##   FIRST STEP, NUMBER OF ATHLETES FROM COUNTRY
    ##

    data['Country Name'] = data['Country'].apply(funcs.getCountryName)
    data['Atletas'] = 1

    countryes_sum = data.groupby(['Country',
                                  'Country Name']).agg({"Atletas": np.sum})
    countryes_sum_values = np.array(countryes_sum['Atletas'].tolist())
    countryes_abrev = countryes_sum.index.get_level_values(0)
    countryes_names = countryes_sum.index.get_level_values(1)

    df = pd.DataFrame({
        'Country': countryes_abrev,
        'Country Name': countryes_names,
        'Atletas': countryes_sum_values
    })

    udisp.title_awesome("Quantidade de Atletas por país")

    bars = alt.Chart(df).mark_bar().encode(
        alt.Y('Atletas', type='quantitative', title='Quantidade de Atletas'),
        alt.X('Country Name:N', title='País'),
        tooltip=['Atletas']).properties(height=450)  #, width=700

    text = bars.mark_text(
        align='left',
        baseline='middle',
        dx=2  # Nudges text to right so it doesn't appear on top of the bar
    ).encode(text='Country')

    (bars + text).properties(widht=600)

    st.altair_chart(bars)

    ##
    ##  PAÍSES COM MAIS ATLETAS
    ##

    udisp.title_awesome('Top 10 países com mais atletas')

    total = data.shape[0]

    df['Porcentagem'] = 0

    # df['Porcentagem'].apply(lambda x: calcPorcent(total, x['Atletas']), axis=1 )
    df['Porcentagem'] = df.apply(
        lambda x: funcs.showPercent(funcs.calcPercent(total, x['Atletas'])),
        axis=1)

    df = df.sort_values('Atletas', ascending=False).reset_index().assign(
        hack='').set_index('hack').drop(['index'], axis=1).head(10)

    st.table(df)

    ##
    ##  PAÍSES COM MAIS VENCEDORES NAS CATEGORIAS
    ##

    udisp.title_awesome('Top países com mais vitórias')

    categorias = funcs.getCategories(data)

    totalCat = len(categorias)

    df = data[data['Division Rank'].eq('1')].groupby(
        ['Country', 'Country Name']).agg({"Atletas": np.sum})

    df = df.rename({'Atletas': 'Vitórias'}, axis='columns')

    df = df.sort_values('Vitórias', ascending=False).reset_index().assign(
        hack='').set_index('hack').head(10)

    df['Porcentagem'] = df.apply(lambda x: funcs.showPercent(
        funcs.calcPercent(totalCat, x['Vitórias'])),
                                 axis=1)

    st.table(df)

    option = st.sidebar.selectbox("Selecione a categoria", sorted(categorias))

    Atletas_m = data.loc[data['Division'] == f'M{option}']
    Atletas_f = data.loc[data['Division'] == f'F{option}']

    Atletas_m['Gender'] = 'Masculino'
    Atletas_f['Gender'] = 'Feminino'

    q = st.sidebar.selectbox("Quantidade de Atletas", [5, 10, 15, 20])

    udisp.title_awesome(f'Top {q} atletas por país na categoria')

    division_sum_m = Atletas_m.head(int(q)).groupby(
        ['Country', 'Country Name', 'Gender']).agg({"Atletas": np.sum})

    division_sum_f = Atletas_f.head(int(q)).groupby(
        ['Country', 'Country Name', 'Gender']).agg({"Atletas": np.sum})

    topAtletas = pd.concat([division_sum_f, division_sum_m])

    source = pd.DataFrame({
        'abrev': topAtletas.index.get_level_values(0),
        'name': topAtletas.index.get_level_values(1),
        'Sexo': topAtletas.index.get_level_values(2),
        'Atletas': np.array(topAtletas['Atletas'].tolist())
    })

    c = alt.Chart(source).mark_bar().encode(
        x=alt.X('Sexo:N', axis=alt.Axis(title=None)),
        y=alt.Y('Atletas:Q',
                axis=alt.Axis(offset=1)),  #, scale=alt.Scale(round=True)
        color='Sexo:N',
        column=alt.Column('name:N',
                          title='País',
                          header=alt.Header(labelAngle=270,
                                            labelAlign='right')))

    st.altair_chart(c)

    # with Grid("1 1 1", color="#000000", background_color="#FFFFFF") as grid:

    #     grid.cell("a", 1, 2, 1, 2).markdown("**Masculino**")
    #     grid.cell("b", 2, 3, 1, 2).markdown("**Feminino**")

    #     grid.cell("c", 1, 2, 2, 3).dataframe(division_sum_m)
    #     grid.cell("d", 2, 3, 2, 3).dataframe(division_sum_f)

    ##
    ##  Países com mais Atletas entre os top 5
    ##

    udisp.title_awesome(f'Top {q} atletas por país em todas categorias')

    data = funcs.removeNotFinished(data)

    data = data.astype({"Division Rank": int})

    data = data[data['Division Rank'] <= q]

    countryes_sum = data.groupby(['Country', 'Country Name',
                                  'Division']).agg({"Atletas": np.sum})

    # st.table( countryes_sum )

    source = pd.DataFrame({
        'abrev':
        countryes_sum.index.get_level_values(0),
        'name':
        countryes_sum.index.get_level_values(1),
        'Categoria':
        countryes_sum.index.get_level_values(2),
        'Atletas':
        np.array(countryes_sum['Atletas'].tolist())
    })

    color_scale = alt.Scale(
        domain=np.array(countryes_sum.index.get_level_values(2)),
        range=["#c30d24", "#f3a583", "#cccccc", "#94c6da", "#1770ab"])

    y_axis = alt.Axis(
        title=None,  #'País',
        offset=1,
        ticks=False,
        minExtent=60,
        domain=False)

    c = alt.Chart(source).mark_bar().encode(
        x='Atletas:Q',
        y=alt.Y('name:N', axis=y_axis),
        tooltip=['Atletas', 'Categoria'],
        color=alt.Color(
            'Categoria:N',
            legend=alt.Legend(title='Categoria'),
            scale=color_scale,
        ))

    st.altair_chart((c).properties(width=900))
Beispiel #16
0
def write():
    udisp.title_awesome("Step by Step Walkthrough")
Beispiel #17
0
def write():
    udisp.title_awesome('Sobre mim')
    udisp.render_md("resources/about.md")
Beispiel #18
0
def write():
    udisp.title_awesome("Data Analytics")

    keys = {'./data/lynchings.csv'}
    st.header("Dataset")
    pick = st.selectbox("Select Dataset: ", list(keys))

    analysis = {'count', 'date span'}

    df = pd.read_csv(pick, encoding='utf8')

    df.columns = [
        'State', 'Year', 'Month', 'Day', 'Victim', 'County', 'Race', 'Sex',
        'Mob', 'Offense', 'Note', '2nd Name', '3rd Name', 'Comments', 'Source'
    ]
    st.dataframe(df)

    st.header("")
    st.header("")
    st.header("")
    st.header("Aggregation")
    ana = st.selectbox("Select Aggregation: ", list(analysis))

    if ana == 'count':
        st.info("Total Number of Lynchings: " + str(df.shape[0]))

    if ana == 'date span':
        st.info("This data set spans from 1882 - 1930 (48 years)")

    victims = df["Victim"].tolist()

    st.header("")
    st.header("")
    st.header("")
    st.header("Victims")
    tags = st.multiselect("Choose a name", victims)

    for i in tags:
        filtered_data_vic = df[df['Victim'] == str(i)]
        st.dataframe(filtered_data_vic)

    st.header("")
    st.header("")
    st.header("")
    st.header("Group Dataset")
    group = {'State', 'Year', 'Month', 'Race', 'County', 'Offense', 'Sex'}
    pick_grp = st.selectbox("Groupby: ", list(group))

    df3 = df.groupby(pick_grp).count()

    df3 = df3[['Victim']]
    df3.columns = ['Count']

    st.dataframe(df3)

    st.header("")
    st.header("")
    st.header("")
    st.header("Filter Data Set")

    st.subheader("Month")
    month_to_filter = st.slider('Filter Data By Month', 0, 12, 8)
    filtered_data_mon = df[df['Month'] == str(month_to_filter)]
    st.dataframe(filtered_data_mon)

    st.header("")
    st.subheader("Year")
    year_to_filter = st.slider('Filter Data By Year', 1882, 1930, 1900)
    filtered_data_yr = df[df['Year'] == str(year_to_filter)]
    st.dataframe(filtered_data_yr)

    states = {'AL', 'AR', 'FL', 'GA', 'KY', 'LA', 'MS', 'NC', 'SC', 'TN'}

    st.header("")
    st.subheader("State")
    pick_st = st.selectbox("Filter By State: ", list(states))
    filtered_data_st = df[df['State'] == str(pick_st)]
    st.dataframe(filtered_data_st)

    race = {'Blk', 'Other', 'Unk', 'Wht'}

    st.header("")
    st.subheader("Race")
    pick_rc = st.selectbox("Filter By Race: ", list(race))
    filtered_data_rc = df[df['Race'] == str(pick_rc)]
    st.dataframe(filtered_data_rc)

    sex = {'Male', 'Fe', 'Unk'}
    st.header("")
    st.subheader("Sex")
    pick_sex = st.selectbox("Filter By Sex: ", list(sex))
    filtered_data_sex = df[df['Sex'] == str(pick_sex)]
    st.dataframe(filtered_data_sex)
def write():
    udisp.title_awesome("Data Analytics")
    
    
    keys = {
    'Facebook Watch Topics For Recommendation': './data/information_used_for_recommendations/facebook_watch_topics_for_recommendations.csv',
    'Facebook News Feed Topics For Recommendation': './data/information_used_for_recommendations/news_feed_topics_for_recommendations.csv'
    'Facebook News Topics For Recommendations': './data/information_used_for_recommendations/news_topics_for_recommendations.csv'
      } 
    st.header("Dataset")
    pick = st.selectbox("Select Dataset: ", list(keys.keys()))
    
    
    analysis = {
    'count',
    'date span'
            }
    
    
    df = pd.read_csv(keys[pick], encoding='utf8')
    
    
    #df.columns = ['State','Year','Month','Day','Victim','County','Race','Sex','Mob','Offense','Note','2nd Name','3rd Name','Comments','Source']
    st.dataframe(df)
    
    st.header("")
    st.header("")
    # st.header("")
    # st.header("Aggregation")
    # #ana = st.selectbox("Select Aggregation: ", list(analysis))
    
    # #if ana=='count':
    # #    st.info("Total Number of Lynchings: " + str(df.shape[0]))
    
    # if ana=='date span':
        # st.info("This data set spans from 1882 - 1930 (48 years)")
        
    # victims = df["Victim"].tolist()    
    
    
    # st.header("")
    # st.header("")
    # st.header("")
    # st.header("Victims")
    # tags = st.multiselect("Choose a name", victims)
    
    # for i in tags:
        # filtered_data_vic = df[df['Victim'] == str(i)]
        # st.dataframe(filtered_data_vic)
    
    
    # st.header("")
    # st.header("")
    # st.header("")
    # st.header("Group Dataset")
    # group = {
    # 'State',
    # 'Year',
    # 'Month',
    # 'Race',
    # 'County',
    # 'Offense',
    # 'Sex'    
            # }
    # pick_grp = st.selectbox("Groupby: ", list(group))
    
    # df3 = df.groupby(pick_grp).count()
    
    # df3 = df3[['Victim']]
    # df3.columns = ['Count']
    
    # st.dataframe(df3)
    
    
    # st.header("")
    # st.header("")
    # st.header("")
    # st.header("Filter Data Set")
    
    # st.subheader("Month")
    # month_to_filter = st.slider('Filter Data By Month', 0, 12, 8)
    # filtered_data_mon = df[df['Month'] == str(month_to_filter)]
    # st.dataframe(filtered_data_mon)
    
    
    # st.header("")
    # st.subheader("Year")
    # year_to_filter = st.slider('Filter Data By Year', 1882, 1930, 1900)
    # filtered_data_yr = df[df['Year'] == str(year_to_filter)]
    # st.dataframe(filtered_data_yr)
    
    
    # states = {
    # 'AL',
    # 'AR',
    # 'FL',
    # 'GA',
    # 'KY',
    # 'LA',
    # 'MS',
    # 'NC',
    # 'SC',
    # 'TN'
            # }
            
    # st.header("")
    # st.subheader("State")        
    # pick_st = st.selectbox("Filter By State: ", list(states))
    # filtered_data_st = df[df['State'] == str(pick_st)]
    # st.dataframe(filtered_data_st)
    
    
    # race = {
    # 'Blk',
    # 'Other',
    # 'Unk',
    # 'Wht'
            # }
    
    # st.header("")
    # st.subheader("Race")
    # pick_rc = st.selectbox("Filter By Race: ", list(race))
    # filtered_data_rc = df[df['Race'] == str(pick_rc)]
    # st.dataframe(filtered_data_rc)
    
    
    # sex = {
    # 'Male',
    # 'Fe',
    # 'Unk'
            # }
    # st.header("")
    # st.subheader("Sex")        
    # pick_sex = st.selectbox("Filter By Sex: ", list(sex))
    # filtered_data_sex = df[df['Sex'] == str(pick_sex)]
    # st.dataframe(filtered_data_sex)
Beispiel #20
0
def write():
    udisp.title_awesome("Step by Step Code Review")
    udisp.render_md("resources/codestudy.md")
Beispiel #21
0
def write():
    udisp.title_awesome("About")
    udisp.render_md("resources/credits.md")

    st.write("Thanks!!")
    st.write("@avkashchauhan")
Beispiel #22
0
def write():
    udisp.title_awesome("Puzzle Solver")
    SolverQuickDemo.run_main(
        "Info", "Just select the image, model type and puzzle size, and GO")
Beispiel #23
0
def write():
    udisp.title_awesome("Calculator")
    CalcEngine.calc_main("Calculator",
                         "A simple calclator to operator two digits")

    st.write("@avkashchauhan")
Beispiel #24
0
def write():
    udisp.title_awesome("About")

    udisp.render_md("resources/about.md")
Beispiel #25
0
def write():

    ##
    ##  Médias
    ##

    udisp.title_awesome('Médias por modalidade nas categorias')

    q = st.sidebar.selectbox("Quantidade de Atletas", [10, 20, 30, 50])

    cats = data['Division'].unique()

    arr = []

    for c in cats:
        arr.append(calculeMedianFromCat(c, q))

    df = pd.DataFrame(arr)

    # st.table(df)

    df1 = funcs.prep_df(df, 'Swim', 1)
    df2 = funcs.prep_df(df, 'T1', 2)
    df3 = funcs.prep_df(df, 'Bike', 3)
    df4 = funcs.prep_df(df, 'T2', 4)
    df5 = funcs.prep_df(df, 'Run', 5)

    df = pd.concat([df1, df2, df3, df4, df5])

    df['Time'] = df.apply(lambda x: f'2019-10-10T{formatHour(x["Tempo"])}Z',
                          axis=1)

    # df['Time'] = pd.to_datetime(df['Time'])
    df = df.astype({'Time': 'datetime64[ns]'})

    # st.table(df)

    st.altair_chart(
        alt.Chart(df).mark_bar().encode(
            x=alt.X('Segundos:Q', axis=alt.Axis(
                title=None)),  #hoursminutes( , format = ("%H:%M")
            # x=alt.X('hoursminutes(Time):O', axis=alt.Axis( title=None, format = ("%H:%M"))), #hoursminutes( , format = ("%H:%M")
            y=alt.Y('Name:N',
                    axis=alt.Axis(grid=False, title=None),
                    sort=alt.EncodingSortField(field="Segundos",
                                               op="sum",
                                               order='ascending')),
            color=alt.Color(
                'Classe:N',
                sort=['SwimN', 'T1N', 'BikeN', 'T2N', 'RunN'],
                scale=alt.Scale(scheme='tableau20')
            ),  #scale=alt.Scale(range=['#96ceb4', '#BF820E','#4BA55E', '#4FA7A5', '#CBBE00'])
            tooltip=['Tempo:N'],
            order=alt.Order('Order', sort='ascending')).configure_view(
                strokeOpacity=0).properties(height=500, width=850))

    ##
    ##   Tempo dos vencedores por categoria
    ##

    udisp.title_awesome('Tempo dos vencedores por categoria')

    df = data[data['Division Rank'].eq('1')]

    df = pd.DataFrame({
        'Categoria': df['Division'].tolist(),
        'Tempo': df['Overall'].tolist()
    })

    st.table(df.reset_index().assign(hack='').set_index('hack').drop(['index'],
                                                                     axis=1))
Beispiel #26
0
def write():
    udisp.title_awesome("Puzzle Solver Home")
    udisp.render_md("resources/home_info.md")
Beispiel #27
0
def write():
    udisp.title_awesome("3D Photo Creator Demo")
    CreatorQuickDemo.run_main('Info', 'Select the image and GO')
Beispiel #28
0
def write():
    udisp.title_awesome("Step by Step Walkthrough")
    CustomSolver.run_main(
        "Configration",
        "Just select the image, model type and puzzle size, and GO")
Beispiel #29
0
def write():
    udisp.title_awesome("Data Visualizations")
    st.write("Strange Fruits")

    keys = {'./data/lynchings.csv'}
    st.header("Dataset")
    pick = st.selectbox("Select Dataset: ", list(keys))

    df = pd.read_csv(pick, encoding='utf8')

    df.columns = [
        'State', 'Year', 'Month', 'Day', 'Victim', 'County', 'Race', 'Sex',
        'Mob', 'Offense', 'Note', '2nd Name', '3rd Name', 'Comments', 'Source'
    ]
    st.dataframe(df)

    group = {'State', 'Year', 'Month', 'Race', 'County', 'Offense', 'Sex'}

    st.header("")
    st.header("")
    st.header("")
    st.header("Choose an Attribute to Visualize")
    pick_grp = st.selectbox("Choose: ", list(group))

    df3 = df.groupby(pick_grp).count()

    df3 = df3[['Victim']]
    df3.columns = ['Count']
    df3['x-axis'] = df3.index

    st.header("")
    st.subheader("Line Graph")
    fig2 = px.line(df3,
                   x="x-axis",
                   y="Count",
                   title="A graph of the number Lynchings grouped by " +
                   str(pick_grp))
    st.plotly_chart(fig2)

    fig = px.scatter(df3, x="x-axis", y="Count")

    st.header("")
    st.subheader("Scatter Diagram of the number of Lynchings grouped by " +
                 str(pick_grp))

    st.plotly_chart(fig)

    st.header("")
    st.subheader("Pie Chart of the number of Lynchings grouped by " +
                 str(pick_grp))

    fig1 = go.Figure(data=[go.Pie(labels=df3['x-axis'], values=df3['Count'])])
    st.plotly_chart(fig1)

    words = df.Victim.tolist()
    word_could_dict = Counter(words)
    wordcloud = WordCloud(
        width=1000, height=500).generate_from_frequencies(word_could_dict)

    st.header("")
    st.subheader("WordCloud of the names of the Lynching Victims")
    plt.figure(figsize=[20, 10])
    plt.imshow(wordcloud)
    plt.axis("off")
    plt.show()
    st.pyplot()