Información de Fisher nivel nodo: Metztitlán 1

  • Dra. Melanie Kolb
  • M. en F. C. Gustavo Magallanes-Guijón
  • Dr. Oliver López-Corona
In [2]:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import sys, os
import datetime
from matplotlib.pylab import rcParams
%matplotlib inline
import warnings
import seaborn as sns
import functools 
In [3]:
!ls *.csv > lista.txt
In [4]:
lista = pd.read_csv('lista.txt', header = None)
list_of_rows = [j for j in lista.values]
# Print list of lists i.e. rows
len(list_of_rows)
Out[4]:
11
In [5]:
filesnames = os.listdir()
filesnames = [f for f in filesnames if (f.endswith(".csv"))]
In [6]:
dfs = list()
string = "_df"
for filename in filesnames:
    #print(filename)
    #nueva = string.join(filename)
    df = pd.read_csv(filename)
    dfs.append(df)    
In [8]:
merged = pd.merge(dfs[0], dfs[1])
#for i in range(len(dfs)):
for i in range(len(dfs)):
    merged = pd.merge(merged, dfs[i])
In [ ]:
 
In [9]:
merged
Out[9]:
2012-12-05 473.0 0.0003 0.3968 1.1717 0.0062 42.0 187.5 0.0864 40.0 10.0 193.466
0 2013-04-17 2481.0 0.000300 0.035600 0.986100 0.003100 140.00 50.0 0.048700 85.0 20.000000 243.1216
1 2014-04-03 1793.0 0.000320 0.072000 0.633000 0.002000 66.00 25.0 0.175000 60.0 41.000000 255.8000
2 2014-08-12 246.0 0.000160 0.443000 1.249000 0.013000 40.00 75.0 0.072000 77.5 20.000000 160.0000
3 2015-06-16 323.0 0.000155 0.039840 0.835464 0.003081 50.00 25.0 0.053206 25.0 104.500000 199.6100
4 2015-09-13 774.0 0.000069 0.233971 0.994569 0.013005 92.00 60.0 0.035550 55.0 189.000000 82.5100
5 2016-03-05 426.0 0.000374 0.007416 0.787711 0.003000 56.00 30.0 0.171312 36.0 129.333330 204.3400
6 2016-09-18 794.0 0.000100 0.167066 1.150808 0.003503 24.00 50.0 0.036990 30.0 69.666664 152.6400
7 2017-03-15 691.0 0.000098 0.012639 0.924348 0.002806 70.00 40.0 0.133493 32.0 10.000000 212.1800
8 2018-02-11 530.0 0.000096 0.145809 0.906767 0.006472 53.00 18.0 0.062647 30.0 30.000000 222.7200
9 2018-08-09 1523.0 0.000386 0.155897 1.482869 0.014452 304.00 30.0 0.047518 65.0 121.000000 216.5900
10 2018-10-27 2481.0 0.000110 0.894489 1.870572 0.036445 44.35 30.0 0.047550 22.0 909.000000 152.7100
11 2019-02-15 265.0 0.000044 0.012847 0.406699 0.002202 33.60 25.0 0.036650 20.0 41.000000 202.7700
In [10]:
merged = pd.merge(dfs[0], dfs[1])
In [19]:
merged = pd.merge(merged, dfs[10])
merged
Out[19]:
2012-12-05 473.0 0.0003 0.3968 1.1717 0.0062 42.0 187.5 0.0864 40.0 10.0 193.466
0 2013-04-17 2481.0 0.000300 0.035600 0.986100 0.003100 140.00 50.0 0.048700 85.0 20.000000 243.1216
1 2014-04-03 1793.0 0.000320 0.072000 0.633000 0.002000 66.00 25.0 0.175000 60.0 41.000000 255.8000
2 2014-08-12 246.0 0.000160 0.443000 1.249000 0.013000 40.00 75.0 0.072000 77.5 20.000000 160.0000
3 2015-06-16 323.0 0.000155 0.039840 0.835464 0.003081 50.00 25.0 0.053206 25.0 104.500000 199.6100
4 2015-09-13 774.0 0.000069 0.233971 0.994569 0.013005 92.00 60.0 0.035550 55.0 189.000000 82.5100
5 2016-03-05 426.0 0.000374 0.007416 0.787711 0.003000 56.00 30.0 0.171312 36.0 129.333330 204.3400
6 2016-09-18 794.0 0.000100 0.167066 1.150808 0.003503 24.00 50.0 0.036990 30.0 69.666664 152.6400
7 2017-03-15 691.0 0.000098 0.012639 0.924348 0.002806 70.00 40.0 0.133493 32.0 10.000000 212.1800
8 2018-02-11 530.0 0.000096 0.145809 0.906767 0.006472 53.00 18.0 0.062647 30.0 30.000000 222.7200
9 2018-08-09 1523.0 0.000386 0.155897 1.482869 0.014452 304.00 30.0 0.047518 65.0 121.000000 216.5900
10 2018-10-27 2481.0 0.000110 0.894489 1.870572 0.036445 44.35 30.0 0.047550 22.0 909.000000 152.7100
11 2019-02-15 265.0 0.000044 0.012847 0.406699 0.002202 33.60 25.0 0.036650 20.0 41.000000 202.7700
In [20]:
from sklearn import preprocessing

df_num = merged.select_dtypes(include=[np.number])

x = df_num.values #returns a numpy array
min_max_scaler = preprocessing.MinMaxScaler()
x_scaled = min_max_scaler.fit_transform(x)
df_num = pd.DataFrame(x_scaled)
df_num
Out[20]:
0 1 2 3 4 5 6 7 8 9 10
0 1.000000 0.748538 0.031772 0.395800 0.031935 0.414286 0.561404 0.094299 1.000000 0.011123 0.926837
1 0.692170 0.807018 0.072806 0.154591 0.000000 0.150000 0.122807 1.000000 0.615385 0.034483 1.000000
2 0.000000 0.339181 0.491035 0.575392 0.319350 0.057143 1.000000 0.261384 0.884615 0.011123 0.447169
3 0.034452 0.324561 0.036552 0.292898 0.031383 0.092857 0.122807 0.126612 0.076923 0.105117 0.675746
4 0.236242 0.073099 0.255396 0.401585 0.319495 0.242857 0.736842 0.000000 0.538462 0.199110 0.000000
5 0.080537 0.964912 0.000000 0.260277 0.029032 0.114286 0.210526 0.973553 0.246154 0.132740 0.703041
6 0.245190 0.163743 0.179974 0.508315 0.043635 0.000000 0.561404 0.010326 0.153846 0.066370 0.404697
7 0.199105 0.157895 0.005888 0.353616 0.023400 0.164286 0.385965 0.702352 0.184615 0.000000 0.748283
8 0.127069 0.152047 0.156011 0.341606 0.129830 0.103571 0.000000 0.194313 0.153846 0.022247 0.809106
9 0.571365 1.000000 0.167383 0.735153 0.361504 1.000000 0.210526 0.085823 0.692308 0.123471 0.773732
10 1.000000 0.192982 1.000000 1.000000 1.000000 0.072679 0.210526 0.086052 0.030769 1.000000 0.405101
11 0.008501 0.000000 0.006122 0.000000 0.005864 0.034286 0.122807 0.007888 0.000000 0.034483 0.693981
In [21]:
result = pd.concat([merged.select_dtypes(np.object), df_num], axis=1)
result
Out[21]:
2012-12-05 0 1 2 3 4 5 6 7 8 9 10
0 2013-04-17 1.000000 0.748538 0.031772 0.395800 0.031935 0.414286 0.561404 0.094299 1.000000 0.011123 0.926837
1 2014-04-03 0.692170 0.807018 0.072806 0.154591 0.000000 0.150000 0.122807 1.000000 0.615385 0.034483 1.000000
2 2014-08-12 0.000000 0.339181 0.491035 0.575392 0.319350 0.057143 1.000000 0.261384 0.884615 0.011123 0.447169
3 2015-06-16 0.034452 0.324561 0.036552 0.292898 0.031383 0.092857 0.122807 0.126612 0.076923 0.105117 0.675746
4 2015-09-13 0.236242 0.073099 0.255396 0.401585 0.319495 0.242857 0.736842 0.000000 0.538462 0.199110 0.000000
5 2016-03-05 0.080537 0.964912 0.000000 0.260277 0.029032 0.114286 0.210526 0.973553 0.246154 0.132740 0.703041
6 2016-09-18 0.245190 0.163743 0.179974 0.508315 0.043635 0.000000 0.561404 0.010326 0.153846 0.066370 0.404697
7 2017-03-15 0.199105 0.157895 0.005888 0.353616 0.023400 0.164286 0.385965 0.702352 0.184615 0.000000 0.748283
8 2018-02-11 0.127069 0.152047 0.156011 0.341606 0.129830 0.103571 0.000000 0.194313 0.153846 0.022247 0.809106
9 2018-08-09 0.571365 1.000000 0.167383 0.735153 0.361504 1.000000 0.210526 0.085823 0.692308 0.123471 0.773732
10 2018-10-27 1.000000 0.192982 1.000000 1.000000 1.000000 0.072679 0.210526 0.086052 0.030769 1.000000 0.405101
11 2019-02-15 0.008501 0.000000 0.006122 0.000000 0.005864 0.034286 0.122807 0.007888 0.000000 0.034483 0.693981
In [22]:
result.to_csv("metztitlan1_merged.csv",index=False, header=False)
In [23]:
os.chdir("fisher-nodo/")
In [25]:
fs = !ls *.png

import IPython.display as dp

# create list of image objects
images = []
for ea in fs:
    images.append(dp.Image(filename=ea, format='png'))

# display all images
for ea in images:
    dp.display_png(ea)