23  Métricas

import pandas as pd
f = "../data/Ti_blanco.csv"
blanco = pd.read_csv(f,index_col=0,parse_dates=True)
blanco.info()

f = "../data/Ti_negro.csv"
negro = pd.read_csv(f,index_col=0,parse_dates=True)
negro.info()
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 52560 entries, 2006-01-01 00:10:00 to 2007-01-01 00:00:00
Data columns (total 4 columns):
 #   Column  Non-Null Count  Dtype  
---  ------  --------------  -----  
 0   Ti_C    52560 non-null  float64
 1   Ti_R1   52560 non-null  float64
 2   Ti_R2   52560 non-null  float64
 3   Ti_S    52560 non-null  float64
dtypes: float64(4)
memory usage: 2.0 MB
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 52560 entries, 2006-01-01 00:10:00 to 2007-01-01 00:00:00
Data columns (total 4 columns):
 #   Column  Non-Null Count  Dtype  
---  ------  --------------  -----  
 0   Ti_C    52560 non-null  float64
 1   Ti_R1   52560 non-null  float64
 2   Ti_R2   52560 non-null  float64
 3   Ti_S    52560 non-null  float64
dtypes: float64(4)
memory usage: 2.0 MB
blanco
Ti_C Ti_R1 Ti_R2 Ti_S
date
2006-01-01 00:10:00 19.014610 19.024472 19.065057 19.106503
2006-01-01 00:20:00 19.012693 19.022505 19.062782 19.104997
2006-01-01 00:30:00 19.011030 19.020820 19.060846 19.103773
2006-01-01 00:40:00 19.009526 19.019312 19.059129 19.102714
2006-01-01 00:50:00 19.008070 19.017864 19.057494 19.101684
... ... ... ... ...
2006-12-31 23:20:00 19.589577 19.517255 19.780842 19.902851
2006-12-31 23:30:00 19.572531 19.500154 19.757842 19.882044
2006-12-31 23:40:00 19.555469 19.482987 19.734803 19.861207
2006-12-31 23:50:00 19.538364 19.465734 19.711720 19.840302
2007-01-01 00:00:00 19.521151 19.448329 19.688533 19.819254

52560 rows × 4 columns

negro
Ti_C Ti_R1 Ti_R2 Ti_S
date
2006-01-01 00:10:00 19.038413 19.047696 19.087096 19.129994
2006-01-01 00:20:00 19.035998 19.045313 19.084383 19.128110
2006-01-01 00:30:00 19.033880 19.043235 19.082035 19.126533
2006-01-01 00:40:00 19.031973 19.041355 19.079928 19.125138
2006-01-01 00:50:00 19.030158 19.039552 19.077921 19.123787
... ... ... ... ...
2006-12-31 23:20:00 24.137526 23.391216 23.667201 24.646797
2006-12-31 23:30:00 24.064361 23.323456 23.589420 24.567420
2006-12-31 23:40:00 23.990232 23.257064 23.512465 24.488597
2006-12-31 23:50:00 23.917165 23.191858 23.436305 24.410237
2007-01-01 00:00:00 23.846178 23.127226 23.360837 24.332185

52560 rows × 4 columns

diff  = blanco - negro
(blanco.Ti_C - negro.Ti_C ).mean()
np.float64(-5.308517736666285)
(blanco.Ti_C - negro.Ti_C ).std()
np.float64(2.11990130443126)
diff.mean()
Ti_C    -5.308518
Ti_R1   -5.111807
Ti_R2   -5.039647
Ti_S    -5.076488
dtype: float64
diff.median()
Ti_C    -5.132381
Ti_R1   -4.885755
Ti_R2   -4.733711
Ti_S    -4.845651
dtype: float64
diff.resample("M")
C:\Users\gbv\AppData\Local\Temp\ipykernel_57928\2919733548.py:1: FutureWarning: 'M' is deprecated and will be removed in a future version, please use 'ME' instead.
  diff.resample("M")
<pandas.core.resample.DatetimeIndexResampler object at 0x00000202A8F7D640>
diff.resample("3H").mean()
C:\Users\gbv\AppData\Local\Temp\ipykernel_57928\3329997795.py:1: FutureWarning: 'H' is deprecated and will be removed in a future version, please use 'h' instead.
  diff.resample("3H").mean()
Ti_C Ti_R1 Ti_R2 Ti_S
date
2006-01-01 00:00:00 -0.021167 -0.020358 -0.019159 -0.020962
2006-01-01 03:00:00 -0.017316 -0.015935 -0.014671 -0.016956
2006-01-01 06:00:00 -0.015232 -0.013807 -0.012120 -0.014461
2006-01-01 09:00:00 -0.023016 -0.022017 -0.021280 -0.022006
2006-01-01 12:00:00 -0.031571 -0.031032 -0.031827 -0.031410
... ... ... ... ...
2006-12-31 12:00:00 -5.025595 -4.172613 -4.128075 -4.715904
2006-12-31 15:00:00 -6.143345 -5.158807 -5.343249 -6.114931
2006-12-31 18:00:00 -5.896546 -5.067058 -5.307056 -6.196140
2006-12-31 21:00:00 -4.859050 -4.156382 -4.210848 -5.082399
2007-01-01 00:00:00 -4.325027 -3.678896 -3.672305 -4.512931

2921 rows × 4 columns

diff.resample("3M").mean()
C:\Users\gbv\AppData\Local\Temp\ipykernel_57928\1973734845.py:1: FutureWarning: 'M' is deprecated and will be removed in a future version, please use 'ME' instead.
  diff.resample("3M").mean()
Ti_C Ti_R1 Ti_R2 Ti_S
date
2006-01-31 -4.314191 -3.491715 -3.456784 -4.163554
2006-04-30 -5.205744 -4.988880 -4.892002 -5.013828
2006-07-31 -5.998308 -6.372570 -6.308787 -5.721852
2006-10-31 -5.717239 -5.572823 -5.484666 -5.413686
2007-01-31 -4.307009 -3.517697 -3.474178 -4.149963
diff.resample("D").max()
Ti_C Ti_R1 Ti_R2 Ti_S
date
2006-01-01 -0.013989 -0.012218 -0.010572 -0.013044
2006-01-02 -0.009047 -0.008165 -0.005351 -0.008393
2006-01-03 -0.519950 -0.480064 -0.422005 -0.484904
2006-01-04 -0.630201 -0.561868 -0.494864 -0.577895
2006-01-05 -2.829595 -2.438844 -2.349026 -2.968532
... ... ... ... ...
2006-12-28 -2.573831 -2.098926 -1.923344 -2.577069
2006-12-29 -2.717307 -2.238275 -1.970042 -2.660889
2006-12-30 -3.269922 -2.662732 -2.256935 -3.187538
2006-12-31 -3.297358 -2.686110 -2.239008 -3.165496
2007-01-01 -4.325027 -3.678896 -3.672305 -4.512931

366 rows × 4 columns

blanco.resample("YE").max()
Ti_C Ti_R1 Ti_R2 Ti_S
date
2006-12-31 27.291816 27.796187 28.240923 28.290655
2007-12-31 19.521151 19.448329 19.688533 19.819254
  1. diff = mean(Ti_b - T_n)
  2. Diferencia promedio por mes
  3. Desviación estándard
  4. Moda
  5. mean absolute error mean(sum| Ti_b - Ti_n | )
blanco
Ti_C Ti_R1 Ti_R2 Ti_S
date
2006-01-01 00:10:00 19.014610 19.024472 19.065057 19.106503
2006-01-01 00:20:00 19.012693 19.022505 19.062782 19.104997
2006-01-01 00:30:00 19.011030 19.020820 19.060846 19.103773
2006-01-01 00:40:00 19.009526 19.019312 19.059129 19.102714
2006-01-01 00:50:00 19.008070 19.017864 19.057494 19.101684
... ... ... ... ...
2006-12-31 23:20:00 19.589577 19.517255 19.780842 19.902851
2006-12-31 23:30:00 19.572531 19.500154 19.757842 19.882044
2006-12-31 23:40:00 19.555469 19.482987 19.734803 19.861207
2006-12-31 23:50:00 19.538364 19.465734 19.711720 19.840302
2007-01-01 00:00:00 19.521151 19.448329 19.688533 19.819254

52560 rows × 4 columns

negro
Ti_C Ti_R1 Ti_R2 Ti_S
date
2006-01-01 00:10:00 19.038413 19.047696 19.087096 19.129994
2006-01-01 00:20:00 19.035998 19.045313 19.084383 19.128110
2006-01-01 00:30:00 19.033880 19.043235 19.082035 19.126533
2006-01-01 00:40:00 19.031973 19.041355 19.079928 19.125138
2006-01-01 00:50:00 19.030158 19.039552 19.077921 19.123787
... ... ... ... ...
2006-12-31 23:20:00 24.137526 23.391216 23.667201 24.646797
2006-12-31 23:30:00 24.064361 23.323456 23.589420 24.567420
2006-12-31 23:40:00 23.990232 23.257064 23.512465 24.488597
2006-12-31 23:50:00 23.917165 23.191858 23.436305 24.410237
2007-01-01 00:00:00 23.846178 23.127226 23.360837 24.332185

52560 rows × 4 columns

blanco.Ti_C * negro.Ti_C
date
2006-01-01 00:10:00    362.007996
2006-01-01 00:20:00    361.925572
2006-01-01 00:30:00    361.853663
2006-01-01 00:40:00    361.788785
2006-01-01 00:50:00    361.726578
                          ...    
2006-12-31 23:20:00    472.843913
2006-12-31 23:30:00    471.000451
2006-12-31 23:40:00    469.140241
2006-12-31 23:50:00    467.302274
2007-01-01 00:00:00    465.504851
Name: Ti_C, Length: 52560, dtype: float64