In [ ]:
# Установка дополнительных пакетов
import sys
!{sys.executable} -m pip install matplotlib sklearn pandas requests seaborn --user
In [ ]:
import matplotlib.pyplot as plt
import numpy as np
from sklearn import datasets
import pandas as pd
import matplotlib as mpl
import io
import requests

mpl.rcParams['figure.figsize'] = (12, 8)
%matplotlib inline

Scatter plot

In [ ]:
iris = datasets.load_iris()
iris_df = pd.DataFrame(iris['data'], columns=iris['feature_names'])
iris_df['species'] = iris['target']

colours = ['red', 'orange', 'blue']
species = ['I. setosa', 'I. versicolor', 'I. virginica']

for i in range(0, 3):    
    species_df = iris_df[iris_df['species'] == i]    
    #your code here

plt.xlabel('sepal length (cm)')
plt.ylabel('petal length (cm)')
plt.title('Iris dataset: petal length vs sepal length')
plt.legend(loc='lower right')

plt.show()

Графики

In [ ]:
url="https://datahub.io/core/sea-level-rise/r/csiro_alt_gmsl_mo_2015.csv"
s=requests.get(url).content
c=pd.read_csv(io.StringIO(s.decode('utf-8')))
In [ ]:
def lineplot(x_data, y_data, x_label="", y_label="", title="", tics_step = 1):
    #your code here (написать функцию рисующую график и вызвать ее на данных (x = c["Time"], y = c["GMSL"]))
    #подсказка: выставить метки на оси икс можно такой командой ax.xaxis.set_ticks(x_data[0::tics_step])
    pass
In [ ]:
lineplot (c["Time"], c["GMSL"], tics_step=20, x_label="Time", y_label="medium sea level", title="Sea level")

Гистограммы

In [ ]:
import seaborn as sns
In [ ]:
raw_data = datasets.load_wine()
features = pd.DataFrame(data=raw_data['data'],columns=raw_data['feature_names'])
data = features
data['target']=raw_data['target']
data['class']=data['target'].map(lambda ind: raw_data['target_names'][ind])
In [ ]:
#your code here (x = data['alcohol'][data.target==i])

Столбчатые диаграммы

In [ ]:
objects = ('Python', 'C++', 'Java', 'Perl', 'Scala', 'Lisp')
y_pos = np.arange(len(objects))
performance = [10,8,6,4,2,1]
 
#your code here

Box Plots

In [ ]:
tips = sns.load_dataset("tips")
desired_tips = [tips["total_bill"][tips["day"] == day] for day in np.unique(tips["day"])]
In [ ]:
#your code here (sns.boxplot (...., hue="smoker",...)
In [ ]: