0% found this document useful (0 votes)
14 views12 pages

Tarea - 1.ipynb - Colab Jose

Uploaded by

Akihiro Flex
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views12 pages

Tarea - 1.ipynb - Colab Jose

Uploaded by

Akihiro Flex
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

4/6/24, 21:30 Tarea_1.

ipynb - Colab

keyboard_arrow_down ESCUELA SUPERIOR POLITÉCNICA DE CHIMBORAZO

FACULTAD DE CIENCIAS

CARRERA DE INGENIERÍA AMBIENTAL


NOMBRE: JOSE ANTUASH

CURSO: PAO4

import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt

datos = pd.read_csv('/iris.data.csv')
datos

https://colab.research.google.com/drive/1gB-mf4pvhAeh-RUOzT8667rnngng-7hu#printMode=true 1/12
4/6/24, 21:30 Tarea_1.ipynb - Colab

sepal.length sepal.width petal.length petal.width species

0 5.1 3.5 1.4 0.2 Iris-setosa

1 4.9 3.0 1.4 0.2 Iris-setosa

2 4.7 3.2 1.3 0.2 Iris-setosa

3 4.6 3.1 1.5 0.2 Iris-setosa

4 5.0 3.6 1.4 0.2 Iris-setosa

... ... ... ... ... ...

145 6.7 3.0 5.2 2.3 Iris-virginica

146 6.3 2.5 5.0 1.9 Iris-virginica

147 6.5 3.0 5.2 2.0 Iris-virginica

148 6.2 3.4 5.4 2.3 Iris-virginica

149 5.9 3.0 5.1 1.8 Iris-virginica

150 rows × 5 columns

datos.describe()

sepal.length sepal.width petal.length petal.width

count 150.000000 150.000000 150.000000 150.000000

mean 5.843333 3.054000 3.758667 1.198667

std 0.828066 0.433594 1.764420 0.763161

min 4.300000 2.000000 1.000000 0.100000

25% 5.100000 2.800000 1.600000 0.300000

50% 5.800000 3.000000 4.350000 1.300000

75% 6.400000 3.300000 5.100000 1.800000

max 7.900000 4.400000 6.900000 2.500000

datos["sepal.length"]

0 5.1
1 4.9
2 4.7
3 4.6
4 5.0
...
145 6.7
146 6.3
147 6.5
148 6.2
149 5.9
Name: sepal.length, Length: 150, dtype: float64
https://colab.research.google.com/drive/1gB-mf4pvhAeh-RUOzT8667rnngng-7hu#printMode=true 2/12
4/6/24, 21:30 Tarea_1.ipynb - Colab

datos["sepal.width"].max()

4.4

datos["sepal.width"].mean()

3.0540000000000003

datos["sepal.width"].value_counts()

sepal.width
3.0 26
2.8 14
3.2 13
3.1 12
3.4 12
2.9 10
2.7 9
2.5 8
3.5 6
3.3 6
3.8 6
2.6 5
2.3 4
3.7 3
2.4 3
2.2 3
3.6 3
3.9 2
4.4 1
4.0 1
4.1 1
4.2 1
2.0 1
Name: count, dtype: int64

datos["sepal.width"].min()

2.0

datos["sepal.width"][10:60]

10 3.7
11 3.4
12 3.0
13 3.0
14 4.0
15 4.4
16 3.9
17 3.5
18 3.8
19 3.8
20 3.4
21 3.7

https://colab.research.google.com/drive/1gB-mf4pvhAeh-RUOzT8667rnngng-7hu#printMode=true 3/12
4/6/24, 21:30 Tarea_1.ipynb - Colab
22 3.6
23 3.3
24 3.4
25 3.0
26 3.4
27 3.5
28 3.4
29 3.2
30 3.1
31 3.4
32 4.1
33 4.2
34 3.1
35 3.2
36 3.5
37 3.1
38 3.0
39 3.4
40 3.5
41 2.3
42 3.2
43 3.5
44 3.8
45 3.0
46 3.8
47 3.2
48 3.7
49 3.3
50 3.2
51 3.2
52 3.1
53 2.3
54 2.8
55 2.8
56 3.3
57 2.4
58 2.9
59 2.7
Name: sepal.width, dtype: float64

datos["sepal.width"][2:10].mean()

3.325

datos["sepal.width"][3:15].mean()

3.375

datos["sepal.width"][10:30].max()

4.4

datos["sepal.width"][5:20].min()

2.9

https://colab.research.google.com/drive/1gB-mf4pvhAeh-RUOzT8667rnngng-7hu#printMode=true 4/12
4/6/24, 21:30 Tarea_1.ipynb - Colab

datos.plot()

<Axes: >

datos.plot.scatter(x="petal.length",y="sepal.width",c= "green")

<Axes: xlabel='petal.length', ylabel='sepal.width'>

https://colab.research.google.com/drive/1gB-mf4pvhAeh-RUOzT8667rnngng-7hu#printMode=true 5/12
4/6/24, 21:30 Tarea_1.ipynb - Colab

datos.plot.hist()

<Axes: ylabel='Frequency'>

datos["sepal.width"].plot.hist()

<Axes: ylabel='Frequency'>

datos.plot.box()

https://colab.research.google.com/drive/1gB-mf4pvhAeh-RUOzT8667rnngng-7hu#printMode=true 6/12
4/6/24, 21:30 Tarea_1.ipynb - Colab

<Axes: >

Diagrama de Cajas o Box Plot :es un método estandarizado para representar gráficamente una
serie de datos numéricos a través de sus cuartiles. De esta manera, se muestran a simple vista
la mediana y los cuartiles de los datos,y también pueden representarse sus valores atípicos.

datos.groupby('species').boxplot()

https://colab.research.google.com/drive/1gB-mf4pvhAeh-RUOzT8667rnngng-7hu#printMode=true 7/12
4/6/24, 21:30 Tarea_1.ipynb - Colab

Iris-setosa Axes(0.1,0.559091;0.363636x0.340909)
Iris-versicolor Axes(0.536364,0.559091;0.363636x0.340909)
Iris-virginica Axes(0.1,0.15;0.363636x0.340909)
dtype: object

datos.groupby('species').boxplot(figsize=(9,9))

https://colab.research.google.com/drive/1gB-mf4pvhAeh-RUOzT8667rnngng-7hu#printMode=true 8/12
4/6/24, 21:30 Tarea_1.ipynb - Colab

Iris-setosa Axes(0.1,0.559091;0.363636x0.340909)
Iris-versicolor Axes(0.536364,0.559091;0.363636x0.340909)
Iris-virginica Axes(0.1,0.15;0.363636x0.340909)
dtype: object

datos.groupby('species').boxplot(figsize=(9,9),rot=25)

https://colab.research.google.com/drive/1gB-mf4pvhAeh-RUOzT8667rnngng-7hu#printMode=true 9/12
4/6/24, 21:30 Tarea_1.ipynb - Colab

Iris-setosa Axes(0.1,0.559091;0.363636x0.340909)
Iris-versicolor Axes(0.536364,0.559091;0.363636x0.340909)
Iris-virginica Axes(0.1,0.15;0.363636x0.340909)
dtype: object

tabla=pd.pivot_table(datos,values='sepal.width',index='species',aggfunc=np.mean)
tabla

sepal.width

species

Iris-setosa 3.418

Iris-versicolor 2.770

Iris-virginica 2.974

https://colab.research.google.com/drive/1gB-mf4pvhAeh-RUOzT8667rnngng-7hu#printMode=true 10/12
4/6/24, 21:30 Tarea_1.ipynb - Colab

tabla=pd.pivot_table(datos,values='petal.width',index='species',aggfunc=np.mean)
tabla

petal.width

species

Iris-setosa 0.244

Iris-versicolor 1.326

Iris-virginica 2.026

tabla.plot(kind="bar")

<Axes: xlabel='species'>

import io
import requests
import seaborn as sns
import timeit
import matplotlib.pyplot as plt

datos.info()

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 150 entries, 0 to 149
https://colab.research.google.com/drive/1gB-mf4pvhAeh-RUOzT8667rnngng-7hu#printMode=true 11/12
4/6/24, 21:30 Tarea_1.ipynb - Colab
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 sepal.length 150 non-null float64
1 sepal.width 150 non-null float64
2 petal.length 150 non-null float64
3 petal.width 150 non-null float64
4 species 150 non-null object
dtypes: float64(4), object(1)
memory usage: 6.0+ KB

sns.countplot(x='sepal.width',data=datos)

<Axes: xlabel='sepal.width', ylabel='count'>

datos.rename(columns={'sepal.width':'ancho_sepal'},inplace=True)

sns.histplot(datos.ancho_sepal.dropna(),kde=True)
plt.show()

https://colab.research.google.com/drive/1gB-mf4pvhAeh-RUOzT8667rnngng-7hu#printMode=true 12/12

You might also like