Skip to content

Commit 591d6af

Browse files
committed
Update Dash and Heroku materials
1 parent 1054489 commit 591d6af

File tree

24 files changed

+220
-18358
lines changed

24 files changed

+220
-18358
lines changed
-15 KB
Binary file not shown.

python-dash/apps/app_4/avocado.csv

Lines changed: 0 additions & 18250 deletions
This file was deleted.

python-dash/apps/app_4/requirements.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

python-dash/apps/app_4/runtime.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
import dash
2-
import dash_core_components as dcc
3-
import dash_html_components as html
41
import pandas as pd
2+
from dash import Dash, dcc, html
53

6-
data = pd.read_csv("avocado.csv")
7-
data = data.query("type == 'conventional' and region == 'Albany'")
8-
data["Date"] = pd.to_datetime(data["Date"], format="%Y-%m-%d")
9-
data.sort_values("Date", inplace=True)
4+
data = (
5+
pd.read_csv("avocado.csv")
6+
.query("type == 'conventional' and region == 'Albany'")
7+
.assign(Date=lambda data: pd.to_datetime(data["Date"], format="%Y-%m-%d"))
8+
.sort_values(by="Date")
9+
)
1010

11-
app = dash.Dash(__name__)
11+
app = Dash(__name__)
1212

1313
app.layout = html.Div(
1414
children=[
15-
html.H1(
16-
children="Avocado Analytics",
17-
),
15+
html.H1(children="Avocado Analytics"),
1816
html.P(
19-
children="Analyze the behavior of avocado prices"
20-
" and the number of avocados sold in the US"
21-
" between 2015 and 2018",
17+
children=(
18+
"Analyze the behavior of avocado prices and the number"
19+
" of avocados sold in the US between 2015 and 2018"
20+
),
2221
),
2322
dcc.Graph(
2423
figure={
File renamed without changes.
Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
import dash
2-
import dash_core_components as dcc
3-
import dash_html_components as html
41
import pandas as pd
2+
from dash import Dash, dcc, html
53

6-
data = pd.read_csv("avocado.csv")
7-
data = data.query("type == 'conventional' and region == 'Albany'")
8-
data["Date"] = pd.to_datetime(data["Date"], format="%Y-%m-%d")
9-
data.sort_values("Date", inplace=True)
4+
data = (
5+
pd.read_csv("avocado.csv")
6+
.query("type == 'conventional' and region == 'Albany'")
7+
.assign(Date=lambda data: pd.to_datetime(data["Date"], format="%Y-%m-%d"))
8+
.sort_values(by="Date")
9+
)
1010

1111
external_stylesheets = [
1212
{
13-
"href": "https://fonts.googleapis.com/css2?"
14-
"family=Lato:wght@400;700&display=swap",
13+
"href": (
14+
"https://fonts.googleapis.com/css2?"
15+
"family=Lato:wght@400;700&display=swap"
16+
),
1517
"rel": "stylesheet",
1618
},
1719
]
18-
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
20+
app = Dash(__name__, external_stylesheets=external_stylesheets)
1921
app.title = "Avocado Analytics: Understand Your Avocados!"
2022

2123
app.layout = html.Div(
@@ -27,9 +29,10 @@
2729
children="Avocado Analytics", className="header-title"
2830
),
2931
html.P(
30-
children="Analyze the behavior of avocado prices"
31-
" and the number of avocados sold in the US"
32-
" between 2015 and 2018",
32+
children=(
33+
"Analyze the behavior of avocado prices and the number"
34+
" of avocados sold in the US between 2015 and 2018"
35+
),
3336
className="header-description",
3437
),
3538
],
@@ -47,8 +50,7 @@
4750
"x": data["Date"],
4851
"y": data["AveragePrice"],
4952
"type": "lines",
50-
"hovertemplate": "$%{y:.2f}"
51-
"<extra></extra>",
53+
"hovertemplate": "$%{y:.2f}<extra></extra>",
5254
},
5355
],
5456
"layout": {
@@ -62,7 +64,7 @@
6264
"tickprefix": "$",
6365
"fixedrange": True,
6466
},
65-
"colorway": ["#17B897"],
67+
"colorway": ["#17b897"],
6668
},
6769
},
6870
),
@@ -99,6 +101,5 @@
99101
),
100102
]
101103
)
102-
103104
if __name__ == "__main__":
104105
app.run_server(debug=True)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)