En el siguiente ejercicio generaremos algunas variables de gran utilidad en la agricultura. La base de datos que vamos a utilizar esta disponible en la carpeta data con el nombre de data_course_aguascalientes.csv. Esta base de datos contiene la siguiente informacion:
Vamos a generar las siguientes variables
tmed = tmax + tmin / 2
dpoint = pow((humr / 100),0.125) * (112 + (0.9 * tmed )) + (0.1 * tmed) - 112
uc = tmed - tbase
1.8 * ta + 32 - (0.55 - (0.55 * (hr/100.0))) * (1.8 * ta) - 26.0
f = (9.0 / 5.0) * celsius + 32.0
ic = -42.379 + (2.04901523 * f) + (10.14333127 * hr) - (0.22475541 * f * hr) - (6.83783 * pow(10.0,-3) * pow(f, 2.0)) - (5.481717 * pow(10.0,-2) * pow(hr, 2.0)) + (1.22874 * pow(10.0, -3) * pow(f, 2.0) * hr) + (8.5282 * pow(10.0,-4) * f * pow(hr, 2.0)) - (1.99 * pow(10.0, -6) * pow(f, 2.0) * pow(hr, 2.0))
ic1 = -42.379 + (2.04901523 * f)
ic2 = (10.14333127 * hr)
ic3 = (0.22475541 * f * hr)
ic4 = (6.83783 * pow(10.0,-3) * pow(f, 2.0))
ic5 = (5.481717 * pow(10.0,-2) * pow(hr, 2.0))
ic6 = (1.22874 * pow(10.0, -3) * pow(f, 2.0) * hr)
ic7 = (8.5282 * pow(10.0,-4) * f * pow(hr, 2.0))
ic8 = (1.99 * pow(10.0, -6) * pow(f, 2.0) * pow(hr, 2.0))
ic = ic1 + ic2 - ic3 - ic4 - ic5 + ic6 + ic7 - ic8
In [1]:
#librerias
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
In [2]:
# modificar la ubicacion del archivo segun sea el lugar en que se ejecuta jupyter notebook
data = pd.read_csv('../data/data_course_aguascalientes.csv')
In [3]:
data.head()
Out[3]:
number
name
lat
long
year
month
day
rain
tmax
tmin
humr
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
28.69
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
43.80
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
47.47
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
43.51
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
43.82
In [4]:
data.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 165037 entries, 0 to 165036
Data columns (total 11 columns):
number 165037 non-null int64
name 165037 non-null object
lat 165037 non-null float64
long 165037 non-null float64
year 165037 non-null int64
month 165037 non-null int64
day 165037 non-null int64
rain 160835 non-null float64
tmax 161958 non-null float64
tmin 161958 non-null float64
humr 161834 non-null float64
dtypes: float64(6), int64(4), object(1)
memory usage: 13.9+ MB
In [5]:
data.describe()
Out[5]:
number
lat
long
year
month
day
rain
tmax
tmin
humr
count
165037.000000
165037.000000
165037.000000
165037.000000
165037.000000
165037.000000
160835.000000
161958.000000
161958.000000
161834.000000
mean
26314.726110
21.998813
-102.345655
2010.176888
6.481286
15.707029
1.468346
25.614227
9.712370
51.444880
std
77002.485938
0.175265
0.196767
4.307068
3.420633
8.798114
5.309940
4.242971
4.595636
19.074347
min
2.000000
21.660453
-102.769444
2002.000000
1.000000
1.000000
0.000000
-34.500000
-35.300000
1.000000
25%
13473.000000
21.864800
-102.459050
2007.000000
4.000000
8.000000
0.000000
23.200000
6.500000
36.330000
50%
18833.000000
21.978000
-102.295194
2010.000000
6.000000
16.000000
0.000000
25.900000
10.500000
52.000000
75%
24576.000000
22.141889
-102.254778
2014.000000
9.000000
23.000000
0.000000
28.400000
13.400000
66.500000
max
860030.000000
22.363722
-101.969306
2017.000000
12.000000
31.000000
118.400000
59.900000
59.900000
100.000000
In [6]:
Registros_totales = data['number'].count()
Registros_totales
Out[6]:
165037
In [7]:
# eliminar datos nulos
data = data.dropna()
In [8]:
Registros_SinNulos = data['number'].count()
Registros_SinNulos
Out[8]:
160304
In [9]:
(Registros_SinNulos / Registros_totales) * 100
Out[9]:
97.13215824330301
In [10]:
data['tmed'] = (data['tmax'] + data['tmin']) / 2
In [11]:
data.head()
Out[11]:
number
name
lat
long
year
month
day
rain
tmax
tmin
humr
tmed
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
28.69
18.40
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
43.80
16.60
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
47.47
12.55
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
43.51
13.75
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
43.82
13.25
In [12]:
data['dpoint'] = pow((data['humr'] / 100),0.125) * (112 + (0.9 * data['tmed'] )) + (0.1 * data['tmed']) - 112
In [13]:
data.head()
Out[13]:
number
name
lat
long
year
month
day
rain
tmax
tmin
humr
tmed
dpoint
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
28.69
18.40
-0.177856
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
43.80
16.60
4.154008
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
47.47
12.55
1.585546
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
43.51
13.75
1.462383
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
43.82
13.25
1.105996
In [14]:
data['uc'] = data['tmed'] - 10
In [15]:
data.head()
Out[15]:
number
name
lat
long
year
month
day
rain
tmax
tmin
humr
tmed
dpoint
uc
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
28.69
18.40
-0.177856
8.40
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
43.80
16.60
4.154008
6.60
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
47.47
12.55
1.585546
2.55
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
43.51
13.75
1.462383
3.75
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
43.82
13.25
1.105996
3.25
In [16]:
data['gcg_v'] = 1.8 * data['tmed'] + 32 - (0.55 - (0.55 * (data['humr'] / 100.0))) * (1.8 * data['tmed'] ) - 26.0
In [17]:
data.head()
Out[17]:
number
name
lat
long
year
month
day
rain
tmax
tmin
humr
tmed
dpoint
uc
gcg_v
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
28.69
18.40
-0.177856
8.40
26.130170
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
43.80
16.60
4.154008
6.60
26.644092
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
47.47
12.55
1.585546
2.55
22.063410
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
43.51
13.75
1.462383
3.75
23.060299
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
43.82
13.25
1.105996
3.25
22.480588
In [18]:
# clasificar rangos
# confort
data['gcg_confort'] = [1 if x < 74 else 0 for x in data['gcg_v']]
In [19]:
data.head()
Out[19]:
number
name
lat
long
year
month
day
rain
tmax
tmin
humr
tmed
dpoint
uc
gcg_v
gcg_confort
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
28.69
18.40
-0.177856
8.40
26.130170
1
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
43.80
16.60
4.154008
6.60
26.644092
1
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
47.47
12.55
1.585546
2.55
22.063410
1
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
43.51
13.75
1.462383
3.75
23.060299
1
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
43.82
13.25
1.105996
3.25
22.480588
1
In [20]:
# alerta
data['gcg_alerta'] = [1 if (x > 74) & (x < 78) else 0 for x in data['gcg_v']]
In [21]:
data.head()
Out[21]:
number
name
lat
long
year
month
day
rain
tmax
tmin
humr
tmed
dpoint
uc
gcg_v
gcg_confort
gcg_alerta
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
28.69
18.40
-0.177856
8.40
26.130170
1
0
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
43.80
16.60
4.154008
6.60
26.644092
1
0
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
47.47
12.55
1.585546
2.55
22.063410
1
0
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
43.51
13.75
1.462383
3.75
23.060299
1
0
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
43.82
13.25
1.105996
3.25
22.480588
1
0
In [22]:
# peligro
data['gcg_peligro'] = [1 if (x > 78) & (x < 83) else 0 for x in data['gcg_v']]
In [23]:
data.head()
Out[23]:
number
name
lat
long
year
month
day
rain
tmax
tmin
humr
tmed
dpoint
uc
gcg_v
gcg_confort
gcg_alerta
gcg_peligro
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
28.69
18.40
-0.177856
8.40
26.130170
1
0
0
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
43.80
16.60
4.154008
6.60
26.644092
1
0
0
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
47.47
12.55
1.585546
2.55
22.063410
1
0
0
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
43.51
13.75
1.462383
3.75
23.060299
1
0
0
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
43.82
13.25
1.105996
3.25
22.480588
1
0
0
In [24]:
# emergencia
data['gcg_emergencia'] = [1 if x > 83 else 0 for x in data['gcg_v']]
In [25]:
data.head()
Out[25]:
number
name
lat
long
year
month
day
rain
tmax
tmin
humr
tmed
dpoint
uc
gcg_v
gcg_confort
gcg_alerta
gcg_peligro
gcg_emergencia
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
28.69
18.40
-0.177856
8.40
26.130170
1
0
0
0
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
43.80
16.60
4.154008
6.60
26.644092
1
0
0
0
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
47.47
12.55
1.585546
2.55
22.063410
1
0
0
0
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
43.51
13.75
1.462383
3.75
23.060299
1
0
0
0
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
43.82
13.25
1.105996
3.25
22.480588
1
0
0
0
In [26]:
data['fahrenheit'] = (9.0 / 5.0) * data['tmed'] + 32.0
In [27]:
data.head()
Out[27]:
number
name
lat
long
year
month
day
rain
tmax
tmin
humr
tmed
dpoint
uc
gcg_v
gcg_confort
gcg_alerta
gcg_peligro
gcg_emergencia
fahrenheit
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
28.69
18.40
-0.177856
8.40
26.130170
1
0
0
0
65.12
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
43.80
16.60
4.154008
6.60
26.644092
1
0
0
0
61.88
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
47.47
12.55
1.585546
2.55
22.063410
1
0
0
0
54.59
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
43.51
13.75
1.462383
3.75
23.060299
1
0
0
0
56.75
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
43.82
13.25
1.105996
3.25
22.480588
1
0
0
0
55.85
In [28]:
data['ic'] = -42.379 + (2.04901523 * data['fahrenheit']) + (10.14333127 * data['humr']) - (0.22475541 * data['fahrenheit'] * data['humr']) - (6.83783 * pow(10.0,-3) * pow(data['fahrenheit'], 2.0)) - (5.481717 * pow(10.0,-2) * pow(data['humr'], 2.0)) + (1.22874 * pow(10.0, -3) * pow(data['fahrenheit'], 2.0) * data['humr']) + (8.5282 * pow(10.0,-4) * data['fahrenheit'] * pow(data['humr'], 2.0)) - (1.99 * pow(10.0, -6) * pow(data['fahrenheit'], 2.0) * pow(data['humr'], 2.0))
In [29]:
data.head()
Out[29]:
number
name
lat
long
year
month
day
rain
tmax
tmin
...
tmed
dpoint
uc
gcg_v
gcg_confort
gcg_alerta
gcg_peligro
gcg_emergencia
fahrenheit
ic
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
...
18.40
-0.177856
8.40
26.130170
1
0
0
0
65.12
76.297257
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
...
16.60
4.154008
6.60
26.644092
1
0
0
0
61.88
80.882946
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
...
12.55
1.585546
2.55
22.063410
1
0
0
0
54.59
90.017028
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
...
13.75
1.462383
3.75
23.060299
1
0
0
0
56.75
86.146182
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
...
13.25
1.105996
3.25
22.480588
1
0
0
0
55.85
87.385714
5 rows × 21 columns
In [30]:
# clasificar rangos
# normal
data['ic_normal'] = [1 if x < 80 else 0 for x in data['ic']]
In [31]:
data.head()
Out[31]:
number
name
lat
long
year
month
day
rain
tmax
tmin
...
dpoint
uc
gcg_v
gcg_confort
gcg_alerta
gcg_peligro
gcg_emergencia
fahrenheit
ic
ic_normal
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
...
-0.177856
8.40
26.130170
1
0
0
0
65.12
76.297257
1
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
...
4.154008
6.60
26.644092
1
0
0
0
61.88
80.882946
0
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
...
1.585546
2.55
22.063410
1
0
0
0
54.59
90.017028
0
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
...
1.462383
3.75
23.060299
1
0
0
0
56.75
86.146182
0
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
...
1.105996
3.25
22.480588
1
0
0
0
55.85
87.385714
0
5 rows × 22 columns
In [32]:
# precaucion
data['ic_precaucion'] = [1 if (x > 80) & (x < 90) else 0 for x in data['ic']]
In [33]:
data.head()
Out[33]:
number
name
lat
long
year
month
day
rain
tmax
tmin
...
uc
gcg_v
gcg_confort
gcg_alerta
gcg_peligro
gcg_emergencia
fahrenheit
ic
ic_normal
ic_precaucion
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
...
8.40
26.130170
1
0
0
0
65.12
76.297257
1
0
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
...
6.60
26.644092
1
0
0
0
61.88
80.882946
0
1
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
...
2.55
22.063410
1
0
0
0
54.59
90.017028
0
0
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
...
3.75
23.060299
1
0
0
0
56.75
86.146182
0
1
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
...
3.25
22.480588
1
0
0
0
55.85
87.385714
0
1
5 rows × 23 columns
In [34]:
# extrema precaucion
data['ic_ex_precaucion'] = [1 if (x > 90) & (x < 103) else 0 for x in data['ic']]
In [35]:
data.head()
Out[35]:
number
name
lat
long
year
month
day
rain
tmax
tmin
...
gcg_v
gcg_confort
gcg_alerta
gcg_peligro
gcg_emergencia
fahrenheit
ic
ic_normal
ic_precaucion
ic_ex_precaucion
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
...
26.130170
1
0
0
0
65.12
76.297257
1
0
0
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
...
26.644092
1
0
0
0
61.88
80.882946
0
1
0
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
...
22.063410
1
0
0
0
54.59
90.017028
0
0
1
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
...
23.060299
1
0
0
0
56.75
86.146182
0
1
0
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
...
22.480588
1
0
0
0
55.85
87.385714
0
1
0
5 rows × 24 columns
In [36]:
# peligro
data['ic_peligro'] = [1 if (x > 103) & (x < 124) else 0 for x in data['ic']]
In [37]:
data.head()
Out[37]:
number
name
lat
long
year
month
day
rain
tmax
tmin
...
gcg_confort
gcg_alerta
gcg_peligro
gcg_emergencia
fahrenheit
ic
ic_normal
ic_precaucion
ic_ex_precaucion
ic_peligro
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
...
1
0
0
0
65.12
76.297257
1
0
0
0
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
...
1
0
0
0
61.88
80.882946
0
1
0
0
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
...
1
0
0
0
54.59
90.017028
0
0
1
0
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
...
1
0
0
0
56.75
86.146182
0
1
0
0
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
...
1
0
0
0
55.85
87.385714
0
1
0
0
5 rows × 25 columns
In [38]:
# extremadamente peligro
data['ic_ex_peligro'] = [1 if x > 124 else 0 for x in data['ic']]
In [39]:
data.head()
Out[39]:
number
name
lat
long
year
month
day
rain
tmax
tmin
...
gcg_alerta
gcg_peligro
gcg_emergencia
fahrenheit
ic
ic_normal
ic_precaucion
ic_ex_precaucion
ic_peligro
ic_ex_peligro
0
2
La Mirinda
22.248528
-102.251778
2013
2
1
0.0
28.6
8.2
...
0
0
0
65.12
76.297257
1
0
0
0
0
1
2
La Mirinda
22.248528
-102.251778
2013
2
2
0.0
28.6
4.6
...
0
0
0
61.88
80.882946
0
1
0
0
0
2
2
La Mirinda
22.248528
-102.251778
2013
2
3
0.0
24.8
0.3
...
0
0
0
54.59
90.017028
0
0
1
0
0
3
2
La Mirinda
22.248528
-102.251778
2013
2
4
0.0
25.9
1.6
...
0
0
0
56.75
86.146182
0
1
0
0
0
4
2
La Mirinda
22.248528
-102.251778
2013
2
5
0.0
25.9
0.6
...
0
0
0
55.85
87.385714
0
1
0
0
0
5 rows × 26 columns
In [40]:
data.count()
Out[40]:
number 160304
name 160304
lat 160304
long 160304
year 160304
month 160304
day 160304
rain 160304
tmax 160304
tmin 160304
humr 160304
tmed 160304
dpoint 160304
uc 160304
gcg_v 160304
gcg_confort 160304
gcg_alerta 160304
gcg_peligro 160304
gcg_emergencia 160304
fahrenheit 160304
ic 160304
ic_normal 160304
ic_precaucion 160304
ic_ex_precaucion 160304
ic_peligro 160304
ic_ex_peligro 160304
dtype: int64
In [41]:
data.groupby(['year','month']).sum()
Out[41]:
number
lat
long
day
rain
tmax
tmin
humr
tmed
dpoint
...
gcg_alerta
gcg_peligro
gcg_emergencia
fahrenheit
ic
ic_normal
ic_precaucion
ic_ex_precaucion
ic_peligro
ic_ex_peligro
year
month
2002
1
3596862
5878.189661
-27298.580806
4242
276.2
5991.5
548.9
13334.74
3270.20
414.349043
...
0
0
0
14430.36
23816.696439
7
159
91
10
0
2
3394776
5548.372511
-25765.524556
3654
221.6
5635.1
1230.8
13667.84
3432.95
970.571450
...
0
0
0
14243.31
21386.757308
32
192
18
9
1
3
3758502
6142.840994
-28526.116472
4464
0.4
7591.1
1756.8
9830.86
4673.95
263.562230
...
0
0
0
17341.11
22066.734177
195
83
1
0
0
4
3653237
5966.587361
-27707.988933
4215
17.0
8078.3
2750.3
10649.26
5414.30
1451.838608
...
0
0
0
18417.74
21028.860652
248
23
0
0
0
5
6445703
9509.619761
-44294.454200
7308
318.4
13170.7
5769.1
19143.31
9469.90
3790.075984
...
0
0
0
30901.82
33408.793098
422
11
0
0
0
6
6706728
9768.608222
-45529.014222
6884
1150.6
12476.9
6355.4
25676.53
9416.15
5391.824387
...
0
0
0
31189.07
33784.589056
436
9
0
0
0
7
6817081
9989.367583
-46551.823944
7295
1994.0
11341.8
6254.4
33775.10
8798.10
6596.994063
...
0
0
0
30396.58
32907.855035
450
5
0
0
0
8
7005411
10208.591917
-47575.579444
7440
1569.8
12027.8
6012.0
32199.54
9019.90
6246.290899
...
0
0
0
31115.82
34379.390674
458
7
0
0
0
9
6421318
9466.142067
-44089.471550
6576
1599.4
10962.1
5848.8
31945.70
8405.45
6316.951927
...
0
0
0
28921.81
31303.596838
423
8
0
0
0
10
8993465
12158.711783
-56597.902678
8922
885.4
13963.7
6246.2
39082.87
10104.95
7042.830243
...
0
0
0
35884.91
41088.475363
531
22
0
0
0
11
8760232
11829.142389
-55063.226778
8351
478.0
11941.8
3724.9
32392.41
7833.35
3467.047097
...
0
0
0
31316.03
44489.084142
250
167
116
5
0
12
5870120
7915.260556
-36845.745556
3780
1.0
7644.4
1320.2
17904.52
4482.30
652.114511
...
0
0
0
19588.14
32300.013561
39
171
128
15
7
2003
1
9098686
12268.653861
-57110.905611
8928
61.0
11683.7
2542.1
28082.15
7112.90
1143.561319
...
0
0
0
30659.22
49132.240557
52
298
187
21
0
2
8218168
11081.364778
-51584.043778
7308
31.6
12274.0
3121.9
21634.34
7697.95
1189.425706
...
0
0
0
29984.31
41664.011225
131
349
24
0
0
3
9085212
12246.651361
-57008.638944
8907
0.0
14626.7
3628.0
14899.48
9127.35
-1873.216343
...
0
0
0
34253.23
42635.759164
479
72
5
1
0
4
8805180
11872.890833
-55268.618333
8370
11.0
15692.3
5978.7
15722.36
10835.50
440.042246
...
0
0
0
36783.90
40997.956132
527
13
0
0
0
5
9112529
12246.790056
-57009.392306
8958
271.4
17777.7
7417.3
19720.59
12597.50
3076.874597
...
0
0
0
40499.50
42684.551202
550
7
0
0
0
6
9409862
12427.738544
-57826.369394
8799
1460.8
16200.3
8432.7
32370.52
12316.50
7182.864450
...
0
0
0
40249.70
43085.098661
561
4
0
0
0
7
9798697
12955.769722
-60282.056639
9424
4250.4
14889.8
7984.4
42707.23
11437.10
8334.366535
...
0
0
0
39434.78
42722.000351
584
5
0
0
0
8
9082563
11987.669589
-55783.324822
8733
1955.2
13968.0
7125.9
39172.21
10546.95
7620.968191
...
0
0
0
36424.51
39755.358834
544
1
0
0
0
9
8936453
11902.091100
-55368.583217
8400
2376.4
13385.8
7560.5
41498.26
10473.15
8158.838046
...
0
0
0
36163.67
38892.052607
524
15
1
0
1
10
9798697
12955.769722
-60282.056639
9424
814.0
14454.1
5896.9
39970.95
10175.50
6533.228360
...
0
0
0
37163.90
45338.672021
408
172
9
0
0
11
9482610
12537.841667
-58337.474167
8835
38.2
14305.2
3943.8
31459.67
9124.50
3862.276347
...
0
0
0
34664.10
46615.107329
242
282
46
0
0
12
9798697
12955.769722
-60282.056639
9424
21.0
13013.1
978.6
24149.25
6995.85
-1040.526882
...
0
0
0
31440.53
51398.866083
86
291
208
4
0
2004
1
9798697
12955.769722
-60282.056639
9424
602.2
11406.1
3045.7
35566.64
7225.90
2612.297693
...
0
0
0
31854.62
52928.061200
55
283
201
50
0
2
9166523
12119.913611
-56392.891694
8265
26.0
12414.4
1913.7
21210.95
7164.05
-749.012582
...
0
0
0
30527.29
46959.020069
109
334
107
1
0
3
9798697
12955.769722
-60282.056639
9424
547.4
15346.5
4893.8
26860.06
10120.15
2721.915054
...
0
0
0
37064.27
46646.402709
391
195
3
0
0
4
9482610
12537.841667
-58337.474167
8835
12.4
15552.2
5063.7
20017.15
10307.95
1063.692730
...
0
0
0
36794.31
44489.154079
444
124
2
0
0
5
9798697
12955.769722
-60282.056639
9424
805.2
17024.6
7429.8
29238.26
12227.20
5485.402466
...
0
0
0
40856.96
45432.700044
567
22
0
0
0
6
9482610
12537.841667
-58337.474167
8835
3653.6
14576.6
7896.4
40769.43
11236.50
8132.805619
...
0
0
0
38465.70
41700.472223
567
3
0
0
0
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
2015
4
19495886
21431.963250
-99678.855639
15083
306.6
26148.6
10782.7
44886.58
18465.65
6580.247760
...
0
0
0
64406.17
76684.554124
850
94
16
14
0
5
20539112
22511.138509
-104692.936242
16368
923.8
29711.4
12272.0
47870.58
20991.70
8528.545498
...
0
0
0
70521.06
79243.501600
971
39
6
7
0
6
19876560
21784.972750
-101315.744750
15345
6250.1
26823.0
14115.3
65882.70
20469.15
13691.860891
...
0
0
0
68524.47
73113.240836
978
12
0
0
0
7
20512160
22467.307209
-104488.298575
16353
4266.2
26718.0
13356.8
70728.89
20037.40
13909.645203
...
0
0
0
68739.32
75313.240368
1005
16
0
0
0
8
20539112
22511.138509
-104692.936242
16368
3032.2
27749.5
13051.6
66670.44
20400.55
13311.123052
...
0
0
0
69456.99
76662.525520
1005
18
0
0
0
9
19876560
21784.972750
-101315.744750
15345
2889.3
26191.5
12782.0
68955.64
19486.75
13680.504972
...
0
0
0
66756.15
73359.532062
953
37
0
0
0
10
25699289
22641.686443
-105307.571133
16548
3482.9
25499.3
11545.6
70303.64
18522.45
12162.529229
...
0
0
0
66268.41
77577.081532
936
77
8
2
6
11
71478330
23090.452090
-107462.093660
16275
253.6
26173.1
10045.3
67523.98
18109.20
10778.022453
...
0
0
0
66196.56
81598.844929
831
213
3
1
2
12
73860881
23192.677993
-107976.610115
16865
835.0
23207.5
6111.1
63311.46
14659.30
6374.143849
...
0
0
0
60146.74
90343.735413
146
695
210
4
0
2016
1
73860879
23170.429466
-107874.358337
16864
174.3
22036.6
2799.3
46786.49
12417.95
-728.937972
...
0
0
0
56080.31
94175.355673
163
438
376
73
4
2
69095661
21675.563048
-100914.722315
14790
360.3
24272.1
4490.6
33531.53
14381.35
-1939.526310
...
0
0
0
57438.43
79105.571826
541
384
58
3
0
3
73860879
23170.429466
-107874.358337
16864
483.8
25859.4
7706.5
41869.29
16782.95
1559.815499
...
0
0
0
63937.31
87089.005537
563
372
49
63
7
4
71478270
22422.996257
-104394.540326
15810
91.6
28652.8
10428.4
29925.95
19540.60
284.273160
...
0
0
0
67813.08
77743.310231
973
47
0
0
0
5
73860879
23170.429466
-107874.358337
16864
244.3
33184.6
13860.6
36426.38
23522.60
5342.142283
...
0
0
0
76068.68
80637.653948
1042
12
0
0
0
6
71478270
22422.996257
-104394.540326
15810
2371.7
29131.8
13823.0
55445.44
21477.40
11090.789447
...
0
0
0
71299.32
77599.727646
1007
13
0
0
0
7
73787130
23103.900216
-107568.144004
16774
5288.3
28438.4
13972.1
70647.98
21205.25
14396.139467
...
0
0
0
71801.45
78064.227180
1042
9
0
0
0
8
73570200
22756.440466
-105933.988531
16665
5601.2
26299.8
14674.3
76623.92
20487.05
15392.022970
...
0
0
0
69996.69
74725.194820
1031
4
0
0
0
9
71231068
22315.870979
-103878.397437
15808
2117.1
26111.8
13017.1
70645.26
19564.45
13641.812694
...
0
0
0
67696.01
75175.883451
994
21
0
0
0
10
73860879
23170.429466
-107874.358337
16864
346.0
27335.2
10608.1
65103.70
18971.65
10933.912787
...
0
0
0
67876.97
81916.502092
823
224
7
0
0
11
71478270
22422.996257
-104394.540326
15810
1040.7
22505.9
8233.2
67945.97
15369.55
8801.839046
...
0
0
0
60305.19
81953.893013
494
473
52
1
0
12
73860879
23170.429466
-107874.358337
16864
36.6
24979.6
6581.2
57865.42
15780.40
5960.386329
...
0
0
0
62132.72
87833.161329
259
698
94
3
0
2017
1
73860879
23170.429466
-107874.358337
16864
15.8
24703.3
4545.8
43689.13
14624.55
449.978237
...
0
0
0
60052.19
89518.425136
221
629
197
7
0
2
66713052
20928.129840
-97434.904304
13804
77.6
23658.8
4924.8
34421.46
14291.80
-620.407005
...
0
0
0
56189.24
77418.387368
429
447
75
1
0
3
73860879
23170.429466
-107874.358337
16864
308.8
27996.8
8365.4
39360.75
18181.10
1561.218876
...
0
0
0
66453.98
82679.573231
686
355
13
0
0
4
71478270
22422.996257
-104394.540326
15810
31.7
29631.6
9283.0
28459.57
19457.30
-662.437199
...
0
0
0
67663.14
76962.006757
997
23
0
0
0
5
73860879
23170.429466
-107874.358337
16864
133.2
33448.4
12940.1
31587.79
23194.25
2858.448795
...
0
0
0
75477.65
80289.509208
1045
9
0
0
0
6
71478270
22422.996257
-104394.540326
15810
1510.4
31078.4
14824.6
48756.26
22951.50
10424.682793
...
0
0
0
73952.70
78200.394846
1000
20
0
0
0
7
73860879
23170.429466
-107874.358337
16864
5652.7
28002.6
14353.3
72225.40
21177.95
14643.707394
...
0
0
0
71848.31
77772.440534
1044
10
0
0
0
8
73860921
23637.648549
-110021.645671
17305
4612.4
29080.8
14933.4
71366.03
22007.10
14791.727418
...
0
0
0
74012.78
79874.902787
1068
7
0
0
0
9
42886998
13854.271254
-64477.256196
5985
2506.2
15641.1
7850.7
44897.57
11745.90
8283.218101
...
0
0
0
41302.62
46305.859981
617
13
0
0
0
189 rows × 23 columns
In [42]:
data.columns
Out[42]:
Index(['number', 'name', 'lat', 'long', 'year', 'month', 'day', 'rain', 'tmax',
'tmin', 'humr', 'tmed', 'dpoint', 'uc', 'gcg_v', 'gcg_confort',
'gcg_alerta', 'gcg_peligro', 'gcg_emergencia', 'fahrenheit', 'ic',
'ic_normal', 'ic_precaucion', 'ic_ex_precaucion', 'ic_peligro',
'ic_ex_peligro'],
dtype='object')
In [ ]:
data.groupby(['year','month','name']).sum()['uc']
In [ ]:
Content source: jorgemauricio/INIFAP_Course
Similar notebooks: