# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load

import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

# Input data files are available in the read-only "../input/" directory
# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory

import os
for dirname, _, filenames in os.walk('/kaggle/input'):
    for filename in filenames:
        print(os.path.join(dirname, filename))

# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using "Save & Run All" 
# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session
dfguapo = pd.read_csv(r"/kaggle/input/the-human-freedom-index/hfi_cc_2020.csv")
"""
# Obtén una lista con los atributos cuantitativos y otra lista con los atributos cualitativos.
"""
variablescuali = list()
variablescuanti = list()
for x,i in zip(dfguapo.columns,dfguapo.dtypes):
    if i == np.int64:
        variablescuanti.append(x)
    elif i == np.float64:
        variablescuanti.append(x)
    else:
        variablescuali.append(x)
"""
# Define el rango de cada uno de los atributos (cuantitativos).
"""
for j in variablescuanti:
    print(str(j)+": "+str(np.max(dfguapo[j])-np.min(dfguapo[j])))
"""
# Obtén la moda o promedio dependiendo el caso para cada atributo.
"""
import sympy
import numpy as np
import scipy
from scipy import stats 
for i,x in dfguapo.iteritems():
    if i in variablescuanti:
        print(str(i)+": "+str(np.mean(x)))
    elif i in variablescuali:
        print(str(i)+": "+(str(stats.mode(x)[0][0])))
"""
# Obtén el rango, varianza, desviación estandar para los atributos cuantitativos.
"""
for j in variablescuanti:
    print(str(j)+": "+str(np.max(dfguapo[j])-np.min(dfguapo[j]))+", "+str(np.var(dfguapo[j]))+", "+str(np.std(dfguapo[j])))