Learn practical skills, build real-world projects, and advance your career
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.impute import SimpleImputer
x = np.linspace(0,10,100)
y = np.sin(x)
plt.plot(x,y)
[<matplotlib.lines.Line2D at 0x7fad6c9d3c50>]
Notebook Image
plt.scatter(x[::1],y[::1], color ='r')
<matplotlib.collections.PathCollection at 0x7fad6ca83390>
Notebook Image
plt.plot(x,y,'b')
plt.plot(x,np.cos(x), 'g')
[<matplotlib.lines.Line2D at 0x7fad6c49e4a8>]
Notebook Image
df = pd.read_csv('covid_19_data.csv')
df.drop(['SNo', 'Last Update'],axis=1, inplace = True) #inplace to makes the changes to df itself
df.rename(columns={'ObservationDate':'Date', 'Province/State':'Province', 'Country/Region':'Country'}, inplace=True) #rename columns
imputer = SimpleImputer(strategy = 'constant')
df2 = pd.DataFrame(imputer.fit_transform(df), columns=df.columns)
df3 = df2.groupby(['Country','Date'])[['Country','Date','Confirmed','Deaths', 'Recovered']].sum().reset_index()
df3