|
1 | 1 | from datetime import date
|
| 2 | + |
2 | 3 | from epidatpy import CovidcastEpidata, Epidata, EpiRange
|
3 | 4 |
|
4 |
| -apicall = Epidata.covidcast("fb-survey", "smoothed_cli", "day", "nation", EpiRange(20210405, 20210410), "us") |
| 5 | +print("Epidata Test") |
| 6 | +apicall = Epidata.pub_covidcast("fb-survey", "smoothed_cli", "nation", "day", "us", EpiRange(20210405, 20210410)) |
5 | 7 |
|
6 | 8 | # Call info
|
7 | 9 | print(apicall)
|
|
11 | 13 | classic = apicall.classic()
|
12 | 14 | print(classic)
|
13 | 15 |
|
14 |
| -r = apicall.csv() |
15 |
| -print(r[0:100]) |
16 |
| - |
17 | 16 | data = apicall.json()
|
18 | 17 | print(data[0])
|
19 | 18 |
|
|
30 | 29 | print(df.dtypes)
|
31 | 30 | print(df.iloc[0])
|
32 | 31 |
|
33 |
| -for row in apicall.iter(): |
34 |
| - print(row) |
35 | 32 |
|
36 | 33 | StagingEpidata = Epidata.with_base_url("https://staging.delphi.cmu.edu/epidata/")
|
37 | 34 |
|
38 |
| -epicall = StagingEpidata.covidcast( |
39 |
| - "fb-survey", "smoothed_cli", "day", "nation", EpiRange(date(2021, 4, 5), date(2021, 4, 10)), "*" |
| 35 | +epicall = StagingEpidata.pub_covidcast( |
| 36 | + "fb-survey", "smoothed_cli", "nation", "day", "*", EpiRange(date(2021, 4, 5), date(2021, 4, 10)) |
40 | 37 | )
|
41 | 38 | print(epicall._base_url)
|
| 39 | + |
| 40 | + |
| 41 | +# Covidcast test |
| 42 | +print("Covidcast Test") |
| 43 | +epidata = CovidcastEpidata() |
| 44 | +print(epidata.source_names) |
| 45 | +epidata["fb-survey"].signal_df |
| 46 | +apicall = epidata[("fb-survey", "smoothed_cli")].call( |
| 47 | + "nation", |
| 48 | + "us", |
| 49 | + EpiRange(20210405, 20210410), |
| 50 | +) |
| 51 | +print(apicall) |
| 52 | + |
| 53 | +classic = apicall.classic() |
| 54 | +print(classic) |
| 55 | + |
| 56 | +data = apicall.json() |
| 57 | +print(data[0]) |
| 58 | + |
| 59 | +df = apicall.df() |
| 60 | +print(df.columns) |
| 61 | +print(df.dtypes) |
| 62 | +print(df.iloc[0]) |
| 63 | +df = apicall.df(disable_date_parsing=True) |
| 64 | +print(df.columns) |
| 65 | +print(df.dtypes) |
| 66 | +print(df.iloc[0]) |
0 commit comments