ritaycw commited on
Commit
72d7f80
·
verified ·
1 Parent(s): eaa6f81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py CHANGED
@@ -1,3 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ## Viz 4
2
  # Import panel and vega datasets
3
 
 
1
+ # start with the setup
2
+
3
+ # supress warnings about future deprecations
4
+ import warnings
5
+ warnings.simplefilter(action='ignore', category=FutureWarning)
6
+
7
+ import pandas as pd
8
+ import altair as alt
9
+ import numpy as np
10
+ import pprint
11
+ import datetime as dt
12
+ from vega_datasets import data
13
+ import matplotlib.pyplot as plt
14
+
15
+ # Solve a javascript error by explicitly setting the renderer
16
+ alt.renderers.enable('jupyterlab')
17
+
18
+ #load data
19
+ # df1=pd.read_csv("https://raw.githubusercontent.com/dallascard/SI649_public/main/altair_hw3/approval_polllist.csv")
20
+ df2=pd.read_csv("https://raw.githubusercontent.com/dallascard/SI649_public/main/altair_hw3/approval_topline.csv")
21
+
22
+ df2['timestamp']=pd.to_datetime(df2['timestamp'])
23
+ df2=pd.melt(df2, id_vars=['president', 'subgroup', 'timestamp'], value_vars=['approve','disapprove']).rename(columns={'variable':'choice', 'value':'rate'})
24
+
25
+
26
+
27
  ## Viz 4
28
  # Import panel and vega datasets
29