# import libraries
import pandas as pd # Import Pandas for data manipulation using dataframes
import numpy as np # Import Numpy for data statistical analysis
import matplotlib.pyplot as plt # Import matplotlib for data visualisation
import random
import seaborn as sns
from fbprophet import Prophet
corona_df = pd.read_csv('/content/covid-data.csv')
corona_df.head()
corona_df.describe()
corona_df.info()
corona_df = corona_df.dropna(how='any',axis=0)
corona_df.isnull().sum()
corona_df = corona_df.sort_values('date')
plt.figure(figsize=(10, 10))
plt.plot(corona_df['date'], corona_df['new_cases'])
plt.figure(figsize=(10, 6))
sns.distplot(corona_df['new_cases'], color='blue')
sns.violinplot(y='new_cases', x = 'continent', data = corona_df)
sns.set(font_scale=0.7)
plt.figure(figsize=[25,12])
sns.countplot(x = 'location', data = corona_df)
plt.xticks(rotation = 45)
sns.set(font_scale=1.5)
plt.figure(figsize=[25,12])
sns.countplot(x = 'date', data = corona_df)
plt.xticks(rotation = 45)
# plot the avocado prices vs. regions for conventional avocados
conventional = sns.catplot('new_cases', 'location', data = corona_df[corona_df['continent']=='Asia'],
hue = 'date',
height = 20)
corona_prophet_df = corona_df[['date', 'new_cases']]
corona_prophet_df
corona_prophet_df = corona_prophet_df.rename(columns={'date': 'ds' , 'new_cases': 'y'})
corona_prophet_df
m = Prophet()
m.fit(corona_prophet_df)
# Forcasting into the future
future = m.make_future_dataframe(periods=365)
forecast = m.predict(future)
forecast
figure = m.plot(forecast, xlabel = 'date', ylabel = 'cases')
figure2 = m.plot_components(forecast)
# dataframes creation for both training and testing datasets
df = pd.read_csv('/content/covid-data.csv')
df = df.dropna(how='any',axis=0)
df_sample = df[df['location']=='India']
df_sample = df_sample.sort_values('date')
plt.plot(df_sample['date'], df_sample['new_cases'])
plt.plot(df_sample['date'], df_sample['new_deaths'])
df_sample = df_sample.rename(columns = {'date': 'ds', 'new_cases': 'y'})
m = Prophet()
m.fit(df_sample)
# Forcasting into the future
future = m.make_future_dataframe(periods=365)
forecast = m.predict(future)
figure = m.plot(forecast, xlabel='date', ylabel='cases')
figure3 = m.plot_components(forecast)
df_sample = df_sample.rename(columns = {'date': 'ds', 'new_deaths': 'y'})
m = Prophet()
m.fit(df_sample)
# Forcasting into the future
future = m.make_future_dataframe(periods=365)
forecast = m.predict(future)
figure = m.plot(forecast, xlabel='date', ylabel='cases')
figure3 = m.plot_components(forecast)