Esempio n. 1
0
def app():
    wp = jp.QuasarPage()
    h1 = jp.QDiv(a=wp,
                 text="Analysis of Course Reviews",
                 classes="text-h3 text=center q-pa-md")
    p1 = jp.QDiv(a=wp, text="These graphs represent course review analysis")
    return wp
Esempio n. 2
0
def app():
    wp = jp.QuasarPage()
    h1 = jp.QDiv(a=wp,
                 text="Analysis of Course Reviews",
                 classes="text-h1 text-right text-bold q-pa-sm")
    p1 = jp.QDiv(a=wp,
                 text="There graphs represent course reviedw analysis",
                 classes='q-mt-xl')
    return wp
Esempio n. 3
0
def app():
    wp = jp.QuasarPage() # We are creating a Quasar page object instance. Will return that instance.
    h1 = jp.QDiv(a=wp, text="Analysis of the happiest day of the week", classes="text-h3 text-center q-pa-md") # H1 Element
    p1 = jp.QDiv(a=wp, text="These graphs represent which day people are the happiest", classes="text-body1") # p Element

    hc = jp.HighCharts(a=wp, options=chart_def)
    hc_data = [{"name":course, "y":ratings} for course,ratings in zip(share.index, share)]
    hc.options.series[0].data = hc_data

    return wp
Esempio n. 4
0
def app():
    wp = jp.QuasarPage()
    h1 = jp.QDiv(a=wp,
                 text="Analysis of Course Reviews",
                 classes="text-h3 text-center q-pa-md")
    p1 = jp.QDiv(a=wp, text="These graphs represent course review analysis")

    hc = jp.HighCharts(a=wp, options=chart_def)
    hc_data = [{"name": v1, "y": v2} for v1, v2 in zip(share.index, share)]
    hc.options.series[0].data = hc_data
    return wp
def app():
    # QDiv is another component of JustPy.
    wp = jp.QuasarPage(
    )  # We are creating a Quasar page object instance. Will return that instance.
    h1 = jp.QDiv(a=wp,
                 text="Analysis of Course Reviews",
                 classes="text-h3 text-center q-pa-md")  # H1 Element
    p1 = jp.QDiv(a=wp,
                 text="These graphs represent course review analysis",
                 classes="text-body1")  # p Element
    return wp
Esempio n. 6
0
def app():
    wp = jp.QuasarPage()
    h1 = jp.QDiv(a=wp, text="Analysis of Course Reviews", classes="text-h3 text-center q-pa-md")
    p1 = jp.QDiv(a=wp, text="These graphs represent course review analysis")
    hc = jp.HighCharts(a=wp, options=chart_def)
    hc.options.title.text = "Average Rating by Day"

    hc.options.xAxis.categories = list(day_average.index)
    hc.options.series[0].data = list(day_average['Rating'])

    return wp
Esempio n. 7
0
def app():

    wp = jp.QuasarPage()
    h1 = jp.QDiv(a=wp, text="Analysis of Course Reviews", classes="text-h3 text-center q-pa-md") # H1 Element
    p1 = jp.QDiv(a=wp, text="These graphs represent course review analysis", classes="text-body1") # p Element

    hc = jp.HighCharts(a=wp, options=chart_def)

    hc.options.xAxis.categories = list(month_average_crs.index)

    hc_data = [ {"name": course, "data": [rating for rating in month_average_crs[course]]} for course in month_average_crs.columns ]

    hc.options.series = hc_data

    return wp
Esempio n. 8
0
def app():
    wp = jp.QuasarPage()
    h1 = jp.QDiv(a=wp,
                 text="Analysis of Course Reviews",
                 classes="text-h1 text-right text-bold q-pa-sm")
    p1 = jp.QDiv(a=wp,
                 text="There graphs represent course reviedw analysis",
                 classes='q-mt-xl')

    hc = jp.HighCharts(a=wp, options=chart_def)
    hc.options.title.text = "Average Rating by Day"
    hc.options.xAxis.categories = list(week_average.index)
    hc.options.series[0].data = list(week_average['Rating'])

    return wp
Esempio n. 9
0
def app():
    wp = jp.QuasarPage()
    h1 = jp.QDiv(a=wp,
                 text="Analysis of Course Reviews",
                 classes="text-h3 text-center q-pa-md")
    p1 = jp.QDiv(a=wp, text="These graphs represent course review analysis")

    hc = jp.HighCharts(a=wp, options=chart_def)
    hc.options.xAxis.categories = list(month_average_crs.index)

    hc_data = [{
        "name": v1,
        "data": [v2 for v2 in month_average_crs[v1]]
    } for v1 in month_average_crs.columns]
    hc.options.series = hc_data
    return wp
def app():
    wp = jp.QuasarPage()
    h3z = jp.QDiv(a=wp,
                  text="Analysis of Course Reviews",
                  classes="text-h3 text-center")
    #    p1 = jp.QDiv(a=wp, text="The graphs represent review analysis")
    hc = jp.HighCharts(a=wp, options=chart_def)
    hc.options.title.text = "Average Rating by Day"
    hc.options.chart.inverted = False
    hc.options.subtitle.text = "The graphs represent review analysis"
    hc.options.xAxis.labels.format = "{value}"
    x = day_average.index
    y = day_average["Rating"]
    hc.options.xAxis.categories = list(x)
    hc.options.series[0].data = list(y)
    hc.options.xAxis.title.text = "Date"
    hc.options.yAxis.title.text = "Average Rating"
    hc.options.series[0].name = "Average Rating"
    hc.options.tooltip.pointFormat = "{point.x}: {point.y}"
    """
    x = [3, 6, 8]
    y = [4, 7, 9]
    hc.options.series[0].data = list(zip(x, y))
    hc.options.series[0].data = [[3, 4], [6, 7], [8, 9]]
    """
    return wp
def app():

    wp = jp.QuasarPage()
    h1 = jp.QDiv(a=wp,
                 text="Analysis of Course Reviews",
                 classes="text-h3 text-center q-pa-md")  # H1 Element
    p1 = jp.QDiv(a=wp,
                 text="These graphs represent course review analysis",
                 classes="text-body1")  # p Element

    hc = jp.HighCharts(a=wp, options=chart_def)

    hc.options.xAxis.categories = list(month_average.index)
    hc.options.series[0].data = list(month_average['Rating'])

    return wp
Esempio n. 12
0
def app():
    wp = jp.QuasarPage(
    )  # We are creating a Quasar page object instance. Will return that instance.
    h1 = jp.QDiv(a=wp,
                 text="Analysis of Course Reviews",
                 classes="text-h3 text-center q-pa-md")  # H1 Element
    p1 = jp.QDiv(a=wp,
                 text="These graphs represent course review analysis",
                 classes="text-body1")  # p Element

    hc = jp.HighCharts(a=wp,
                       options=chart_def)  # We will create our HighChart here.

    hc.options.xAxis.categories = list(week_average.index)
    hc.options.series[0].data = list(week_average['Rating'])

    return wp
def app():
    wp = jp.QuasarPage()
    h1 = jp.QDiv(a=wp, text="Analysis of Course Reviews", classes="text-h3 text-center q-pa-md")
 
    hc = jp.HighCharts(a=wp, options=chart_def)
    hc.options.xAxis.categories = list(weekday_average.index.get_level_values(0))
    hc.options.series[0].data = list(round(weekday_average['Rating'],2))
 
    return wp
def app():
    wp = jp.QuasarPage()
    h1 = jp.QDiv(a=wp, text="Analysis of Course Reviews", classes="text-h4 text-center q-pa-md")
    
    hc = jp.HighCharts(a=wp, options=chart_def)
    month_crs_series = [{'name':course_name, 'data':[r for r in month_avg_crs[course_name]]} for course_name in month_avg_crs.columns]
    hc.options.xAxis.categories = list(month_avg_crs.index)
    hc.options.series = month_crs_series
    return wp
Esempio n. 15
0
def app():
    wp = jp.QuasarPage(
    )  # We are creating a Quasar page object instance. Will return that instance.
    h1 = jp.QDiv(a=wp,
                 text="Analysis of the happiest day of the week",
                 classes="text-h3 text-center q-pa-md")  # H1 Element
    p1 = jp.QDiv(
        a=wp,
        text="These graphs represent which day people are the happiest",
        classes="text-body1")  # p Element

    hc = jp.HighCharts(a=wp,
                       options=chart_def)  # We will create our HighChart here.

    hc.options.xAxis.categories = list(
        weekday_average.index.get_level_values(0))
    hc.options.series[0].data = list(weekday_average['Rating'])

    return wp
Esempio n. 16
0
def app():
    wp = jp.QuasarPage()
    h1 = jp.QDiv(a=wp,
                 text="Happiness across Weekdays",
                 classes="text-h4 text-center q-pa-md")

    hc = jp.HighCharts(a=wp, options=chart_def)
    x = [avg_rating_weekday.index[i][1] for i in range(7)]
    print(x)
    y = list(avg_rating_weekday['Rating'])
    print(y)
    hc.options.xAxis.categories = x
    hc.options.series[0].name = "all courses"
    hc.options.series[0].data = y
    return wp
Esempio n. 17
0
def app():
    wp = jp.QuasarPage()
    h1 = jp.QDiv(a=wp,
                 text="Analysis of Course Reviews",
                 classes="text-h4 text-center q-pa-md")

    hc = jp.HighCharts(a=wp, options=chart_def)
    hc.options.xAxis.categories = list(week_average.index)
    hc.options.series[0].data = list(week_average['Rating'])

    hc2 = jp.HighCharts(a=wp, options=chart_def2)
    hc2.options.xAxis.categories = list(month_average.index)
    hc2.options.series[0].data = list(month_average['Rating'])

    return wp
Esempio n. 18
0
def app():
    web_page = jp.QuasarPage()
    h1 = jp.QDiv(a=web_page,
                 text="Analysis of Course Reviews",
                 classes="text-h1 text-center q-pa-md")

    hc = jp.HighCharts(a=web_page, options=chart_def)
    #print(hc.options)
    #print(type(hc.options))

    hc.options.title.text = 'Average Rating by Week'
    hc.options.series[0].name = 'Weekly Rating'
    hc.options.xAxis.categories = list(week_average.index)
    #hc.options.series[0].data = list(zip(day_average.index, day_average['Rating']))
    hc.options.series[0].data = list(week_average['Rating'])

    return web_page
def app():
    web_page = jp.QuasarPage()
    h1 = jp.QDiv(a=web_page,
                 text="Analysis of Course Reviews",
                 classes="text-h1 text-center q-pa-md")

    hc = jp.HighCharts(a=web_page, options=chart_def)

    hc.options.title.text = 'Monthly Average Rating by courses'
    #hc.options.series[0].name = 'Monthly Rating'
    hc.options.xAxis.categories = list(month_average_by_crs.index)
    hc_data = [{
        "name": v1,
        "data": [round(v2, 2) for v2 in month_average_by_crs[v1]]
    } for v1 in month_average_by_crs.columns]
    hc.options.series = hc_data

    return web_page
Esempio n. 20
0
def app():
    web_page = jp.QuasarPage()
    h1 = jp.QDiv(a=web_page,
                 text="Analysis of Course Reviews",
                 classes="text-h1 text-center q-pa-md")
    #p1 = jp.QDiv(a = web_page, text = "These graphs represent course review analysis",
    #             classes = "text-body1 text-weight-medium")

    hc = jp.HighCharts(a=web_page, options=chart_def)
    #print(hc.options)
    #print(type(hc.options))

    hc.options.title.text = 'Average Rating by Day'
    hc.options.series[0].name = 'Daily Rating'
    hc.options.xAxis.categories = list(day_average.index)
    #hc.options.series[0].data = list(zip(day_average.index, day_average['Rating']))
    hc.options.series[0].data = list(day_average['Rating'])

    return web_page
def app():
    wp = jp.QuasarPage()
    h3 = jp.QDiv(a=wp, text="Happiness over the week", classes="text-h3 text-center")
    hc = jp.HighCharts(a=wp, options=contents)
    hc.options.xAxis.categories = list(happiness.index.get_level_values(0))
    """
    hc.options.series = []
    for i in range(len(happiness["Rating"])):
        hc.options.series.append({})
        hc.options.series[i]["name"] = happiness.columns[i]
        hc.options.series[i]["data"] = list(happiness["Rating"].iloc[:, i])
    hc.options.legend.floating = False
"""
    del hc.options.series[1]
    """
    for i in range(len(happiness.index.get_level_values(0))):
        hc.options.series[i].name = happiness.index.get_level_values(0)[i]
"""
    hc.options.series[0].data = list(happiness["Rating"])
    hc.options.yAxis.title.text = "Rating"
    hc.options.title = "Happiness versus Day of the Week"
    return wp
import justpy as jp
import asyncio
import requests as r

pokemons, page = (
    (r.get(it["url"]).json()["sprites"]["front_default"],
     f"{it['name'].title()} pomaga!", "A ty?")
    for it in r.get(f"https://pokeapi.co/api/v2/pokemon?limit=2000").json()
    ["results"]), jp.QuasarPage()
div = jp.QImg(classes='absolute-center',
              style="width: 50vw; height: 90vh",
              a=page)
caption_top, caption_bottom = [
    jp.QDiv(classes=f"absolute-{pos} text-center text-h3")
    for pos in ["top", "bottom"]
]


async def show_pokemon():
    for pokemon in pokemons:
        div.src, caption_top.text, caption_bottom.text = pokemon
        div.delete_components() or all(
            map(lambda it: div.add_component(it),
                [caption_top, caption_bottom]))
        jp.run_task(page.update()) or await asyncio.sleep(2)


jp.justpy(lambda: page, startup=lambda: jp.run_task(show_pokemon()))
Esempio n. 23
0
def app():
    wp = jp.QuasarPage(
    )  # We are creating a Quasar page object instance. Will return that instance.
    h1 = jp.QDiv(a=wp,
                 text="Analysis of Course Reviews",
                 classes="text-h3 text-center q-pa-md")  # H1 Element
    p1 = jp.QDiv(a=wp,
                 text="These graphs represent course review analysis",
                 classes="text-body1")  # p Element
    # We will add HighChart (another JustPy componenent) Graph. For choosing which graph we need, go to:
    # https://www.highcharts.com/docs/index > Charts and Series Types - HighCharts is a JavaScript Library
    # to produce Graphs.
    # Same as Quasar, which is another JavaScript Library, whoever it is unrelated to HighCharts.
    # Python is getting these 2 JavaScript Frameworks together.

    # In our case, we will use Spline Chart: https://www.highcharts.com/docs/chart-and-series-types/spline-chart
    # For this, we need the JavaScript code, so we open the chart in jsFiddle (upper-right corner of the graph),
    # and copy JS code after "   Highcharts.chart('container',   "   All the WAY to the last curly bracket (}) - and
    # we will paste it in our variable chart_def from above ^^^.

    hc = jp.HighCharts(a=wp,
                       options=chart_def)  # We will create our HighChart here.

    # Above 2 prints will only print (on VS Code Terminal, or whethever you run the script from) after we access the page.
    ###print(hc.options.) # same as the JS (actually JSON) code above on the chart_def variable. Python converts it into a Dictionary
    ###print(type(hc.options))

    # NOTE: We can ACCESS and MODIFY all the Dictionary attributes from above (i.e Title, Subtitle, etc) using
    # hc.options.<attribute>

    ###print(hc.options.title.text)
    hc.options.title.text = "Average Rating by Day"
    ###hc.options.series[0].data = [[3,4], [6,7], [8,9]] # [X,Y] axis values. However this is cumbersome and not the
    # proper way to add data. We add data this way:
    # x = [3, 6, 8]
    # y = [4, 7, 9]
    ###hc.options.series[0].data = list(zip(x, y)) # Will produce: [(3,4), (6,7), (8,9)]

    # NOW what really matter. Injecting data from a Dataframe to produce useful Graphs.

    import pandas
    from datetime import datetime
    from pytz import utc
    import matplotlib.pyplot as plt

    data = pandas.read_csv(
        '/Users/jose/Documents/Python Lessons (GitHub)/Python Mega Course - Udemy/Third Application: Data Analysis and Visualization (Part 2: Interactive Charts)/reviews.csv',
        parse_dates=['Timestamp'])

    # Average Rating by Day
    data['Day'] = data['Timestamp'].dt.date
    day_average = data.groupby(['Day']).mean()

    ###hc.options.series[0].data = list(zip(day_average.index, day_average['Rating']))
    # NOTE: However, this also won't fill out the graph because HighCharts considers the dates (day_average.index) as
    # categories types of data, not numbers. To solve this, we need to provide this data in this way:

    hc.options.xAxis.categories = list(
        day_average.index
    )  # We are creating "categories" key inside "xAxis" dictionary.
    hc.options.series[0].data = list(day_average['Rating'])

    return wp