|
| 1 | +Please visit the [wiki](https://github.com/ksator/Machine_Learning_with_Python/wiki) |
| 2 | + |
| 3 | + |
1 | 4 | # Documentation structure
|
2 | 5 |
|
3 | 6 | - [Introduction to arrays using numpy](#introduction-to-arrays-using-numpy)
|
|
20 | 23 |
|
21 | 24 |
|
22 | 25 |
|
23 |
| -# visualize a dataset using seaborn |
24 |
| - |
25 |
| -we will use this example [iris_visualization.py](iris_visualization.py) |
26 |
| - |
27 |
| -seaborn is a python data visualization library based on matplotlib |
28 |
| - |
29 |
| -we will load the iris dataset |
30 |
| -The iris dataset consists of measurements of three types of Iris flowers: Iris Setosa, Iris Versicolor, and Iris Virginica. |
31 |
| -Four features were measured from each sample: the length and the width of the sepals and petals, in centimeters. |
32 |
| -We will visualize the relationship between the 4 features for each of three species of Iris |
33 |
| - |
34 |
| -``` |
35 |
| ->>> import seaborn as sns |
36 |
| ->>> import matplotlib.pyplot as plt |
37 |
| ->>> # load the iris dataset |
38 |
| ->>> iris = sns.load_dataset("iris") |
39 |
| ->>> # return the first 10 rows |
40 |
| ->>> iris.head(10) |
41 |
| - sepal_length sepal_width petal_length petal_width species |
42 |
| -0 5.1 3.5 1.4 0.2 setosa |
43 |
| -1 4.9 3.0 1.4 0.2 setosa |
44 |
| -2 4.7 3.2 1.3 0.2 setosa |
45 |
| -3 4.6 3.1 1.5 0.2 setosa |
46 |
| -4 5.0 3.6 1.4 0.2 setosa |
47 |
| -5 5.4 3.9 1.7 0.4 setosa |
48 |
| -6 4.6 3.4 1.4 0.3 setosa |
49 |
| -7 5.0 3.4 1.5 0.2 setosa |
50 |
| -8 4.4 2.9 1.4 0.2 setosa |
51 |
| -9 4.9 3.1 1.5 0.1 setosa |
52 |
| ->>> # visualize the relationship between the 4 features for each of three species of Iris |
53 |
| ->>> sns.pairplot(iris, hue='species', height=1.5) |
54 |
| -<seaborn.axisgrid.PairGrid object at 0x7fb899ed15f8> |
55 |
| ->>> plt.show() |
56 |
| -``` |
57 |
| - |
58 |
| - |
59 |
| - |
60 |
| -``` |
61 |
| -$ ls seaborn-data/ |
62 |
| -iris.csv |
63 |
| -$ head -10 seaborn-data/iris.csv |
64 |
| -sepal_length,sepal_width,petal_length,petal_width,species |
65 |
| -5.1,3.5,1.4,0.2,setosa |
66 |
| -4.9,3.0,1.4,0.2,setosa |
67 |
| -4.7,3.2,1.3,0.2,setosa |
68 |
| -4.6,3.1,1.5,0.2,setosa |
69 |
| -5.0,3.6,1.4,0.2,setosa |
70 |
| -5.4,3.9,1.7,0.4,setosa |
71 |
| -4.6,3.4,1.4,0.3,setosa |
72 |
| -5.0,3.4,1.5,0.2,setosa |
73 |
| -4.4,2.9,1.4,0.2,setosa |
74 |
| -``` |
75 | 26 | # manipulate dataset with pandas
|
76 | 27 | Pandas is a python library for data manipulation
|
77 | 28 |
|
|
0 commit comments