Exemplo n.º 1
0
def predict_cases_sldata():
    Df_dataset = Datasets.SLDataPreprocess()
    new1 = Df_dataset[["Date_Added", "Detected_Prefecture"]]
    a = new1.groupby("Date_Added").size().values
    df1 = new1.drop_duplicates(subset="Date_Added").assign(Count=a)
    dfnew = df1.pivot_table('Count', ['Date_Added'], 'Detected_Prefecture')
    dfnew.fillna(0, inplace=True)
    return dfnew
Exemplo n.º 2
0
fig0 = px.line(dfsumbyday, x='Date', y='Confirmed', title="<b>Total Cases</b>")

fig0.update_layout(template='plotly_dark')

dfsumbyday = pd.read_csv('sumbyday.csv')
dfsumbyday['Date'] = dfsumbyday['Date'].astype('datetime64')
dfsumbyday['Date'] = dfsumbyday['Date'].astype('datetime64')

fig1 = px.line(dfsumbyday,
               x='Date',
               y='Recovered',
               title="<b>Total Recovered</b>")

fig1.update_layout(template='plotly_dark')

df = Datasets.SLDataPreprocess()
df['Date_Announced'] = df['Date_Announced'].astype('datetime64')
df['Date_Added'] = df['Date_Added'].astype('datetime64')
newDataSet = df.groupby([
    'Detected_Prefecture'
])['Number'].count().to_frame().rename(columns={
    'Detected_Prefecture': 'Cases'
}).reset_index()
fig2 = px.bar(newDataSet,
              x='Detected_Prefecture',
              y='Number',
              title="<b>Cases By City</b>",
              height=600)
# Add figure title
fig2.update_layout(template='plotly_dark')