In [109]:
%matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
from numpy import nan
plt.style.use('ggplot')

In [3]:
from IPython.core.display import HTML
css = open('style-table.css').read() + open('style-notebook.css').read()
HTML('<style>{}</style>'.format(css))


Out[3]:

In [ ]:


In [12]:
# Carpeta Base de Datos Faltantes _ X
# Carga de datos
## Por el momento todos los archivos no se encuentran disponibles para descargar

In [13]:
#Cargar archivo 1 (DISCO2-TR_EXP_ALUMNO_CONTROL.txt)
#Intenté estrategia whitespace pero hay columnas vacías y campos con espacios intermedios (falta1 y falta2)

In [14]:
faltante1 = pd.read_csv("/Users/luis/Desktop/CEMABE/BDfaltantes_X/DISCO2-TR_EXP_ALUMNO_CONTROL.txt", sep='\t', header=0, encoding='latin-1', low_memory=False)
faltante1.head()


Out[14]:
CLAVE_CT ID_ALUMNO ENT MUN LOC AGEB MZA NIVEL MODALIDAD TURNO NIVEL_CAM GRADO GRUPO SEXO FECHA_NAC ENT_NAC PAIS_NAC_CVE PASE_LISTA ID_SEP_ACCION C_CUESTIONARIO
0 01DES0009G2 10009056 1 1 1 835 15 4 1 2 NaN 2 I H 29/08/2000 AGUASCALIENTES NaN 10 1 3
1 01DES0009G2 10008394 1 1 1 835 15 4 1 2 NaN 2 J M 08/04/2000 AGUASCALIENTES NaN 10 1 3
2 01DES0009G2 10008400 1 1 1 835 15 4 1 2 NaN 2 K M 20/10/2000 AGUASCALIENTES NaN 10 1 3
3 01DES0009G2 10008403 1 1 1 835 15 4 1 2 NaN 2 I M 22/09/1999 AGUASCALIENTES NaN 10 1 3
4 01DES0009G2 10008393 1 1 1 835 15 4 1 2 NaN 1 L M 14/05/2001 AGUASCALIENTES NaN 10 1 3

In [15]:
faltante2 = pd.read_csv("/Users/luis/Desktop/CEMABE/BDfaltantes_X/DISCO2-TR_EXP_CUES_CONAFE_ALUMNO.txt", header=0, encoding='latin-1', sep='\t', low_memory=False)
faltante2.head()


Out[15]:
ENT MUN LOC AGEB MZA CLAVE_CT ID_ALUMNO NIVEL MODALIDAD TURNO ... P16_3D P16_3E P16_4 P16_5A P16_5B P16_5C P16_6A P16_6B P16_7 P16_8
0 12 56 46 259 1 12KJN0113Y1 120810379 2 6 1 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
1 12 56 46 259 1 12KJN0113Y1 120810380 2 6 1 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
2 12 56 46 259 1 12KJN0113Y1 120810381 2 6 1 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
3 12 56 46 259 1 12KJN0113Y1 120810382 2 6 1 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
4 12 56 46 259 1 12KJN0113Y1 120810383 2 6 1 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

5 rows × 70 columns


In [16]:
faltante3 = pd.read_csv("/Users/luis/Desktop/CEMABE/BDfaltantes_X/DISCO3-TR_EXP_CUES_ALUMNO.txt", sep='|', header=0, encoding='latin-1')
faltante3.head()


Out[16]:
ENT MUN LOC AGEB MZA CLAVE_CT ID_ALUMNO NIVEL MODALIDAD TURNO ... P16_3D P16_3E P16_4 P16_5A P16_5B P16_5C P16_6A P16_6B P16_7 P16_8
0 23 5 1 263A 28 23DST0031M1 230255772 4 2 1 ... 2 4 2 4 6 8 2 4 2 4
1 23 5 1 263A 28 23DST0031M1 230255773 4 2 1 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
2 23 5 1 263A 28 23DST0031M1 230255774 4 2 1 ... 2 4 2 4 6 8 2 4 2 4
3 23 5 1 263A 28 23DST0031M1 230255775 4 2 1 ... 2 4 2 4 6 8 2 4 2 4
4 23 5 1 263A 28 23DST0031M1 230255776 4 2 1 ... NaN NaN 2 4 NaN NaN 2 NaN 2 4

5 rows × 70 columns


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [17]:
# Carpeta Centros_trabajo_X
# Carga de datos
## Por el momento todos los archivos no se encuentran disponibles para descargar

In [18]:
centrost1 = pd.read_csv("/Users/luis/Desktop/CEMABE/Centros_trabajo_X/TR_EXP_CENTRAB_CONTROL.txt", header=0, sep='|', encoding='latin-1', index_col=0)
centrost1.head()


Out[18]:
CLAVE_CT ENT MUN LOC AGEB MZA NOMBRECT C_CUESTIONARIO C_ESTATUS_CT NIVEL MODALIDAD TURNO CONTROL
ID_INM
48 01KJN0025Y1 1 5 34 004A 1 PREESCOLAR COMUNITARIO 3 6 2 6 1 1
49 01KJN0258N1 1 5 58 004A 800 PREESCOLAR COMUNITARIO 3 6 2 6 1 1
49 01KPR0025O1 1 5 58 004A 800 CURSO COMUNITARIO 3 6 3 6 1 1
50 01KJN0116P1 1 5 87 0073 800 PREESCOLAR COMUNITARIO 3 6 2 6 1 1
51 01KJN0024Z1 1 5 248 004A 6 PREESCOLAR COMUNITARIO 3 6 2 6 1 1

In [19]:
centrost2 = pd.read_csv("/Users/luis/Desktop/CEMABE/Centros_trabajo_X/TR_EXP_CUES_CENTRAB.txt", header=0, sep='|', encoding='latin-1')
centrost2.head()


Out[19]:
ENT MUN LOC AGEB MZA ID_INM CLAVE_CT NIVEL MODALIDAD TURNO ... P298A P298B P298C P299A P299B P300A P300B P311 P312 P313
0 1 1 1 2723 19 523 01DPR0026D1 3 1 1 ... 4499774570 NaN NaN sigloxx1@outlook.com NaN NaN 1 AGUASCALIENTES AGUASCALIENTES AGUASCALIENTES
1 1 1 1 3825 16 524 01DJN0402Z2 2 1 2 ... NaN NaN 1 NaN 1 NaN 1 AGUASCALIENTES AGUASCALIENTES AGUASCALIENTES
2 1 1 1 3825 16 524 01DJN0400B1 2 1 1 ... 4499294036 NaN NaN NaN 1 NaN 1 AGUASCALIENTES AGUASCALIENTES AGUASCALIENTES
3 1 1 1 3825 16 525 01DPR0703M2 3 1 2 ... 4492931467 NaN NaN temachtiani_tv@hotmail.com NaN NaN 1 AGUASCALIENTES AGUASCALIENTES AGUASCALIENTES
4 1 1 1 3825 16 525 01DPR0688K1 3 1 1 ... 4492930501 NaN NaN temachtianitm@gmail.com NaN NaN 1 AGUASCALIENTES AGUASCALIENTES AGUASCALIENTES

5 rows × 189 columns


In [ ]:


In [20]:
centrost3 = pd.read_csv("/Users/luis/Desktop/CEMABE/Centros_trabajo_X/TR_EXP_CUES_CONAFE_INM_CT_LST.txt", header=0, sep='|', encoding='latin-1')
centrost3.head()


Out[20]:
ID_INM CLAVE_CT PA PB PC1 PC2 PC3 PC4 PD PE ... PF2 PF3 PF4 PF5 PF6 PF7 PF8 PG1 PG2 PG3
0 165 01KJN0001O1 01KJN0001O LOS CUERVOS 1 NaN NaN NaN 1 2 ... 0 13 0 99 99 99 99 22 999 999
1 54 01KJN0002N1 01KJN0002N PREESCOLAR COMUNITARIO 1 NaN NaN NaN 1 9 ... 99 99 99 99 99 99 99 22 999 1
2 61 01KJN0004L1 01KJN0004L PREESCOLAR COMUNITARIO 1 NaN NaN NaN 1 2 ... 0 13 30 99 99 99 99 16 999 1
3 104 01KJN0010W1 01KJN0010W AMAPOLAS DEL RIO 1 NaN NaN NaN 1 2 ... 0 13 30 99 99 99 99 19 999 2
4 1 01KJN0015R1 01KJN0015R PREESCOLAR COMUNITARIO 1 NaN NaN NaN 1 2 ... 0 13 30 99 99 99 99 11 0 999

5 rows × 21 columns


In [ ]:


In [21]:
centrost4 = pd.read_csv("/Users/luis/Desktop/CEMABE/Centros_trabajo_X/TR_EXP_REL_GRADOS_GRUPOS_CT.txt", header=0, sep='|', encoding='latin-1')
centrost4.head()


Out[21]:
CLAVE_CT GRADO GRUPO MULTIGRADO
0 01DPR0021I2 3 A 0
1 01DPR0022H2 5 A 0
2 01DPR0022H2 6 A 0
3 01DPR0022H2 4 A 0
4 01DPR0022H2 3 A 0

In [ ]:


In [22]:
# Carpeta Inmueble (3 archivos)
# Carga de datos
## Por el momento todos los archivos no se encuentran disponibles para descargar

In [ ]:


In [23]:
inmueble1 = pd.read_csv("/Users/luis/Desktop/CEMABE/Inmueble/TR_EXP_CUES_INMUEBLE.txt", header=0, sep='|', encoding='latin-1')
inmueble1.head()


Out[23]:
ENT MUN LOC AGEB MZA ID_INM P2A P2B P3 P4A ... P136 P137 P138 P139 P140 P141 P142 P143 P144 P145
0 2 4 1 2876 23 1914 1 NaN 2 CALLE ... 1 1 1 1 2 1 2 2 1 2
1 2 4 1 2880 103 1915 1 NaN 2 AVENIDA ... 2 1 1 1 1 2 2 2 1 1
2 2 4 1 3677 5 1916 1 NaN 2 AVENIDA ... 2 2 1 1 2 2 3 2 1 2
3 2 4 1 3677 9 1917 1 NaN 2 CALLE ... 1 1 1 1 1 1 2 2 2 2
4 2 4 1 3677 23 1918 7 NaN 2 CALLE ... 1 1 1 1 2 2 2 2 1 1

5 rows × 159 columns


In [ ]:


In [24]:
inmueble2 = pd.read_csv("/Users/luis/Desktop/CEMABE/Inmueble/TR_EXP_INMUEBLE_CONTROL.txt", header=0, sep='|', encoding='latin-1', low_memory=False)
inmueble2.head()


Out[24]:
ID_INM ENT_CARGA MUN_CARGA LOC_CARGA AGEB_CARGA MZA_CARGA LONGITUD_CARGA LATITUD_CARGA ALTITUD_CARGA DOMICILIO_CARGA ... Y NOMVIAL NUMEXT1 NEXTALF1 NUMINT NUMINTALF ENTRECA YCALLE DESCRUBIC C_CUESTIONARIO
0 209238 15 109 25 0188 24 -99.096663 19.682048 .000 CALLE CANCER ... 856924.48508 Cancer 75 NaN NaN NaN Sirio Prados del Centro NaN 3
1 209239 15 109 25 181A 20 -99.104237 19.683822 .000 AVENIDA ARPIAS ... 856799.24477 De Recursos Hidraulicos NaN SN NaN NaN Gorgona De las Arpias NaN 3
2 209240 15 109 68 0667 99 -99.137709 19.620886 .000 CALLE BENITO JUAREZ ... 849884.36876 Benito Juarez 76 NaN NaN NaN Benito Juarez Ninguno NaN 3
3 209241 15 109 68 0864 11 -99.138013 19.632750 2253 CALLE FUENTE DE QUIJOTE ... 851143.70765 Fuente de Quijote 14 NaN NaN NaN F. Bella F. de Cibeles NaN 3
4 209242 15 109 68 0864 12 -99.138611 19.632500 .000 AVENIDA REAL DEL BOSQUE ... 849628.41869 Real del Bosque NaN SN NaN NaN Bosque de Araucarias Bosque de Biclamores NaN 3

5 rows × 32 columns


In [25]:
inmueble3 = pd.read_csv("/Users/luis/Desktop/CEMABE/Inmueble/TR_EXP_CUES_CONAFE_INM_CT.txt", header=0, sep='|', encoding='latin-1', low_memory=False, error_bad_lines=False, warn_bad_lines=True)
inmueble3.head()


b'Skipping line 965: expected 84 fields, saw 85\nSkipping line 2720: expected 84 fields, saw 85\nSkipping line 4799: expected 84 fields, saw 85\nSkipping line 24241: expected 84 fields, saw 85\n'
Out[25]:
ENT MUN LOC AGEB MZA ID_INM P2 P3 P4 P5 ... P56 P57A P57B P57C P57D P57E P57F P58A P58B P59
0 1 1 597 1937 2 119 1 1 1 1 ... 2 LOS CUERVOS 6 EL GUARDA AGUASCALIENTES AGUASCALIENTES 20369 JALISCO OJUELOS 1
1 1 1 605 1937 800 121 1 1 1 1 ... 2 NaN NaN NaN AGUASCALIENTES AGUASCALIENTES 20384 AGUASCALIENTES AGUASCALIENTES 2
2 1 1 410 1231 6 1 1 1 1 1 ... 2 CUBA S/N SAN PEDRO CIENEGUILLA AGUASCALIENTES AGUASCALIENTES 20377 AGUASCALIENTE AGUASCALIENTES 1
3 1 1 422 1068 7 2 1 1 2 1 ... 1 CALLE XOCONOXTLE CARRETERA VILLA HIDALGO KM 3 20317 SANTA CRUZ DE LA PRRESA AGUASCALIENTES AGUASCALIENTES 20317 AGUASCALIENTES AGUASCALIENTES 1
4 1 1 466 1250 800 4 1 1 9 1 ... 9 NaN NaN EL TURICATE AGUASCALIENTES AGUASCALIENTE 20287 AGUASCALIENTES AGUASCALIENTES 2

5 rows × 84 columns


In [ ]:


In [26]:
# Carpeta personal
# Cargar datos

In [27]:
personal1 = pd.read_csv("/Users/luis/Desktop/CEMABE/Personal/TR_EXP_ACTIVIDADES_ACADEMICOS.txt", header=0, sep='|', encoding='latin-1')
personal1.head()


Out[27]:
CLAVE_CT CURP ID_PERSONA ENT MUN LOC AGEB MZA NIVEL MODALIDAD TURNO ID_SEP_ACTIVIDAD ESPECIFIQUE
0 09DPR1397U1 GAMC780930MDFRDR06 563996 9 5 1 2907 3 3 1 1 12 NaN
1 09DPR1397U1 GIOM500119MSPRRR03 604899 9 5 1 2907 3 3 1 1 1 NaN
2 09DPR1397U1 GOTG630104HGRNRN05 661562 9 5 1 2907 3 3 1 1 12 NaN
3 09DPR1397U1 HEBG820920HHGRRV04 709072 9 5 1 2907 3 3 1 1 1 NaN
4 09DPR1397U1 HEMN780927MDFRNL03 748238 9 5 1 2907 3 3 1 1 1 NaN

In [ ]:


In [28]:
personal2 = pd.read_csv("/Users/luis/Desktop/CEMABE/Personal/TR_EXP_CUES_CONAFE_PERSONAL.txt", header=0, sep='|', encoding='latin-1')
personal2.head()


/Users/luis/anaconda/lib/python3.4/site-packages/IPython/core/interactiveshell.py:2902: DtypeWarning: Columns (30) have mixed types. Specify dtype option on import or set low_memory=False.
  interactivity=interactivity, compiler=compiler, result=result)
Out[28]:
ENT MUN LOC AGEB MZA CLAVE_CT ID_PERSONA NIVEL MODALIDAD TURNO ... P32H P33A P33B P33C P33D P33E P33F P34 P35 P36
0 1 6 183 0013 7 01KJN0118N1 600815 2 6 1 ... NaN NaN 2 NaN NaN NaN NaN 3 2 2
1 1 1 128 1759 7 01KJN0119M1 106584 2 6 1 ... NaN 1 1 NaN NaN NaN NaN 3 2 2
2 1 1 128 1759 7 01KJN0119M1 742838 2 6 1 ... NaN NaN 1 NaN NaN NaN NaN 3 2 2
3 1 10 21 0069 8 01KJN0124Y1 1067488 2 6 1 ... NaN 3 1 NaN NaN NaN NaN 3 2 2
4 1 1 569 1763 800 01KJN0125X1 1101053 2 6 1 ... NaN NaN 1 NaN NaN NaN NaN 2 2 2

5 rows × 145 columns


In [ ]:


In [29]:
personal3 = pd.read_csv("/Users/luis/Desktop/CEMABE/Personal/TR_EXP_CUES_PERSONAL_PLAZA.txt", header=0, sep='|', encoding='latin-1', error_bad_lines=False, warn_bad_lines=True)
personal3.head()


b'Skipping line 736828: expected 14 fields, saw 15\n'
b'Skipping line 1754835: expected 14 fields, saw 15\n'
b'Skipping line 1973770: expected 14 fields, saw 15\n'
Out[29]:
CLAVE_CT CURP ID_PERSONA NIVEL MODALIDAD TURNO ID_CUES_PERSONAL_PLAZA PA PB PC PD PE PF PG
0 08DES0003F2 CAEJ560713HCHZSV09 226559 4 1 2 957352 076313E0363030000187 1 2 3 1 DOCENTE E0363
1 08DES0003F2 CAEJ560713HCHZSV09 226559 4 1 2 957354 076313E0363030000210 1 2 3 1 DOCENTE E0363
2 08DES0003F2 CAEJ560713HCHZSV09 226559 4 1 2 957348 076313E0363020080071 1 2 2 1 DOCENTE E0363
3 08DES0003F2 CAEJ560713HCHZSV09 226559 4 1 2 957346 076313E0363010000223 1 2 1 1 DOCENTE E0363
4 08DES0003F2 CAEJ560713HCHZSV09 226559 4 1 2 957356 076313E0363030000327 1 2 3 1 DOCENTE E0363

In [ ]:


In [30]:
personal4 = pd.read_csv("/Users/luis/Desktop/CEMABE/Personal/TR_EXP_CUES_PERSONAL.txt", header=0, sep='|', encoding='latin-1', error_bad_lines=False, warn_bad_lines=True)
personal4.head()


b'Skipping line 1801131: expected 197 fields, saw 198\n'
/Users/luis/anaconda/lib/python3.4/site-packages/IPython/core/interactiveshell.py:2902: DtypeWarning: Columns (167,169,172,175,177,178,179,180,181,182,184,185,186,187,188,189,190,191,192) have mixed types. Specify dtype option on import or set low_memory=False.
  interactivity=interactivity, compiler=compiler, result=result)
Out[30]:
ENT MUN LOC AGEB MZA CLAVE_CT CURP ID_PERSONA NIVEL MODALIDAD ... P42_3BC P42_3C P42_3CC P42_3D P42_3E P42_3OT P43A P43B P44 P45
0 1 1 1 2634 1 01DPR0021I2 CARA630911HASSDM02 275244 3 1 ... NaN NaN NaN NaN NaN NaN 1 NaN 2 NaN
1 1 1 1 2634 1 01DPR0021I2 FOVR680704HASLSF06 515000 3 1 ... NaN NaN NaN NaN NaN NaN 1 NaN NaN NaN
2 1 1 1 2634 1 01DPR0021I2 HEBF581003HASRRR06 708850 3 1 ... NaN NaN NaN NaN NaN NaN 1 NaN NaN NaN
3 1 1 1 2634 1 01DPR0021I2 LOGJ760307HASPRR08 882897 3 1 ... NaN NaN NaN NaN NaN NaN 2 NaN NaN NaN
4 1 1 1 2634 1 01DPR0021I2 MANS580920MASRJL09 981735 3 1 ... NaN NaN NaN NaN NaN NaN 1 NaN NaN 1

5 rows × 197 columns


In [ ]:


In [31]:
personal5 = pd.read_csv("/Users/luis/Desktop/CEMABE/Personal/TR_EXP_MATERIAS_MAESTROS.txt", header=0, sep='|', encoding='latin-1', error_bad_lines=False, warn_bad_lines=True)
personal5.head()


/Users/luis/anaconda/lib/python3.4/site-packages/IPython/core/interactiveshell.py:2902: DtypeWarning: Columns (11) have mixed types. Specify dtype option on import or set low_memory=False.
  interactivity=interactivity, compiler=compiler, result=result)
Out[31]:
CLAVE_CT CURP ID_PERSONA ENT MUN LOC AGEB MZA NIVEL MODALIDAD TURNO GRADO GRUPO MATERIA_CVE1 MATERIA_CVE2 MATERIA
0 15KPR0409W1 NaN 667073 15 1 96 0184 1 3 6 1 3 A 3388800000 30300000 EXPLORACION DE LA NATURALEZA Y SOCIEDAD
1 15KPR0409W1 NaN 667073 15 1 96 0184 1 3 6 1 3 A 3388800000 30700000 HISTORIA
2 15KPR0409W1 NaN 667073 15 1 96 0184 1 3 6 1 3 A 3340300000 40300000 FORMACION CIVICA Y ETICA
3 15KPR0409W1 NaN 667073 15 1 96 0184 1 3 6 1 3 A 3340100000 40100000 EDUCACION FISICA
4 15KPR0409W1 NaN 667073 15 1 96 0184 1 3 6 1 3 A 3310300000 10300000 ESPAÑOL

In [ ]:


In [32]:
personal6 = pd.read_csv("/Users/luis/Desktop/CEMABE/Personal/TR_EXP_PERSONAL_CONTROL.txt", header=0, sep='|', encoding='latin-1', error_bad_lines=False, warn_bad_lines=True)
personal6.head()


Out[32]:
CLAVE_CT CURP ID_PERSONA ENT MUN LOC AGEB MZA NIVEL MODALIDAD ... FECHA_NAC ENT_NAC PAIS_NAC_CVE PASE_LISTA ID_SEP_ACCION PLAZA NUM_PLAZAS IMPARTE_CLASES HORAS C_CUESTIONARIO
0 18DST0032Z1 AEBC621005MNTMRL07 51043 18 17 106 0830 79 4 2 ... 05/10/1962 NAYARIT NaN 11 1 0 1 2 NaN 3
1 09PES0287F1 NaN 51044 9 8 1 0283 15 4 1 ... 11/03/1963 DISTRITO FEDERAL NaN 11 2 1 NaN 0 15 3
2 25FJZ0006M4 AEBC630428MSLMRR06 51045 25 6 1 0131 35 9 NaN ... 28/04/1963 SINALOA NaN 53 1 NaN NaN 0 NaN 1
3 18ADG0004K1 AEBC630816MNTMTC08 51046 18 17 1 1275 17 9 NaN ... 16/08/1963 NAYARIT NaN 34 1 0 1 2 NaN 3
4 30EJN1114I1 NaN 51047 30 44 120 0788 6 2 1 ... 21/11/1963 OAXACA NaN 11 1 0 1 2 NaN 3

5 rows × 26 columns


In [ ]:


In [33]:
personal7 = pd.read_csv("/Users/luis/Desktop/CEMABE/Personal/TR_EXP_PLAZAS.txt", header=0, sep='|', encoding='latin-1', error_bad_lines=False, warn_bad_lines=True)
personal7.head()


Out[33]:
CLAVE_CT CURP ID_PERSONA ENT MUN LOC AGEB MZA NIVEL MODALIDAD TURNO PLAZA ID_SEP_VERIFICACION_ACTIVIDAD ID_SEP_ACCION
0 31DIN2078L4 AXBL750311MCCCLC04 130529 31 101 16 0155 14 9 NaN 4 079829 E146100.0310086 2 1
1 31DIN2079K4 IXMD780924MYNCNY08 797759 31 94 10 0055 11 9 NaN 1 079829 E146100.0310016 2 1
2 31DIN2080Z4 SAKI650210MYNNXR03 1535276 31 89 7 0106 1 9 NaN 4 079829 E146100.0310002 2 1
3 31DIN2081Z4 COCE591030MYNRNV01 329515 31 17 17 008A 1 9 NaN 4 079829 E146100.0310087 2 1
4 31DIN2082Y4 PESM720203MYNCBR00 1280336 31 2 11 0053 11 9 NaN 4 079829 E146100.0310006 2 1

In [ ]:
#Transformaciones
##Diccionarios

sustituciones = {
    'P3': {1: 11, 2: 8, 3: 3, 4:0, 5: 0},
    'P11': {0: 1, 1: 1}, #.get(key, 0) #>1
    'P13A': {1: 1.5, 2: 1, 3: 1, 4: 0, 5: 0},
    'P14': {1: 3, 2: 2, 3: 0, 4: 0, 5: 0, 6: 0},
    'P15': {1: 3, 2: 2, 3: 2, 4: 0, 5: 0, 6: 0},
    'P16': {1: 3, 2: 2, 3: 0},
    'P17A': {1: 3, 2: 2, 3: 2, 4: 0, 5: 1, 6: 0},
    'P18A': {1: 3, 2: 2, 3: 2, 4: 1, 5: 0},
    'P19': {1: 1, 2: 0},
    'P20': {1: 3, 2:0},
    'P21': {1: 3, 2:0},
    'P22': {1: 3, 2:0},
    'P23': {1: 5.5, 2:0},
    'P24': {1: 5.5, 2:0},
    'P25': {0: 0, 1: 0.5, 2: 1,}#.get(key, 1) #2+: 1
    'P26': {0: 0, 1: 1}#.get(key, 0) #1+: 1
    'P27': {0: 0, 1: 1}#.get(key, 0) #1+: 1
    'P28': {0: 0.3, 1: 0}#.get(key, 0) #2+: 0
    'P29': {0: 0.3, 1: 0}#.get(key, 0) #2+: 0
    'P30': {0: 0.3, 1: 0}#.get(key, 0) #2+: 0
    'P31': {0: 0.3, 1: 0}#.get(key, 0) #2+: 0
    'P32': {0: 0.3, 1: 0}#.get(key, 0) #2+: 0
    'P33': {0: 0.5, 1: 0}#.get(key, 0) #2+: 0
    'P34': {0: 0, 1: 1}#.get(key, 0) #1+: 1
}

##Funciones
p3 = lambda n: p3_d.get(n)
p11 = lambda n: p11_d.get(n,0)
p12 = lambda n: p12_d.get(n)
p13A
funciones = [p11,p12,p13A, None, p]
#Columnas
##Metatransform
map(lambda x,y:x(y), functions, values)

In [7]:
df = pd.read_excel('INMUEBLES.xlsx')

In [8]:
df.head()


Out[8]:
ENT MUN LOC AGEB MZA ID_INM P2A P2B P3 P4A ... P136 P137 P138 P139 P140 P141 P142 P143 P144 P145
0 2 4 1 2876 23 1914 1 NaN 2 CALLE ... 1 1 1 1 2 1 2 2 1 2
1 2 4 1 2880 103 1915 1 NaN 2 AVENIDA ... 2 1 1 1 1 2 2 2 1 1
2 2 4 1 3677 5 1916 1 NaN 2 AVENIDA ... 2 2 1 1 2 2 3 2 1 2
3 2 4 1 3677 9 1917 1 NaN 2 CALLE ... 1 1 1 1 1 1 2 2 2 2
4 2 4 1 3677 23 1918 7 NaN 2 CALLE ... 1 1 1 1 2 2 2 2 1 1

5 rows × 159 columns


In [18]:
df2=df[df['P3']<6]

In [24]:
df2[(df['P22']==1) & (df['P20']==1)] #Estas respuestas no deberían tener sentido según el archivo de ponderaciones


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)
Out[24]:
ENT MUN LOC AGEB MZA ID_INM P2A P2B P3 P4A ... P136 P137 P138 P139 P140 P141 P142 P143 P144 P145
194 2 4 1 0210 30 1802 1 NaN 2 CALLE ... 1 1 1 1 1 1 1 2 1 1
281 2 4 187 5828 22 2034 1 NaN 2 AVENIDA ... 2 2 1 1 1 1 2 2 1 1
319 2 4 1 3766 50 1947 1 NaN 1 CALLE ... 9 9 9 9 9 3 1 1 2 2
898 5 30 1 2668 23 8942 1 NaN 1 CALLE ... 1 1 1 2 2 1 3 2 1 1
1087 5 33 59 0860 22 10588 2 NaN 1 EJIDO PROGRESO ... 2 2 2 2 2 3 3 3 2 1
1152 5 35 1 1223 1 9320 1 NaN 1 CALLE ... 2 2 1 2 1 3 2 2 1 1
1409 5 7 14 120A 25 10335 1 NaN 2 SIN NOMBRE ... 1 2 2 2 2 3 3 3 2 3
1850 3 8 54 0337 25 5716 7 NaN 2 CALLE ... 1 1 1 1 1 3 2 2 1 2
1907 3 8 54 0939 7 5721 8 MAESTRA 2 CALLE ... 1 1 1 1 2 2 2 2 1 1
1970 4 6 3 0021 22 6594 2 NaN 1 CALLE ... 2 2 1 1 1 3 1 2 2 1
2030 5 35 1 3944 19 9656 7 NaN 2 CALLE ... 1 2 1 2 1 3 1 2 2 2
2032 5 35 1 3959 3 9658 1 NaN 2 CALLE ... 1 2 1 2 2 3 2 2 1 1
2184 4 2 1 1603 21 6285 2 NaN 1 CALLE ... 1 2 2 2 2 2 1 1 2 1
2185 4 2 1 1603 21 6286 1 NaN 1 CALLE ... 1 1 1 1 1 3 1 1 1 2
2202 3 3 1 1856 3 5435 1 NaN 2 CALLE ... 1 1 1 1 1 3 2 2 1 2
2214 4 1 1 0383 14 6023 2 NaN 1 CALLE ... 2 2 2 2 1 3 2 2 1 1
2241 5 17 1 0509 3 10704 1 NaN 1 CALLE ... 2 2 2 2 2 2 3 2 1 1
2267 4 1 1 0383 20 6024 1 NaN 1 CALLE ... 1 1 1 1 1 3 2 2 1 1
2296 5 35 1 2096 27 9599 1 NaN 1 CERRADA ... 1 1 1 2 1 3 1 2 2 1
2366 5 38 41 0513 8 9903 8 DIRECTOR COMISIONADO CON GRUPO 1 NaN ... 9 9 9 9 9 3 3 2 1 2
2409 3 8 54 0869 17 5689 1 NaN 1 CALLE ... 2 2 2 2 1 2 2 1 1 2
2423 5 9 21 0418 15 10432 8 EDUCADORA ENCARGADA 1 SIN NOMBRE ... 2 2 1 2 1 2 2 2 2 1
2433 5 28 1 106A 10 10187 2 NaN 1 CARRETERA ... 2 2 1 2 1 2 2 2 1 1
2453 5 2 1 1788 9 9683 1 NaN 1 CALLE ... 1 1 1 1 1 2 1 2 1 1
2539 4 2 1 136A 6 6316 1 NaN 1 CALLE ... 1 1 1 1 1 3 1 2 1 2
2540 4 4 1 1947 37 6620 1 NaN 1 CALLE ... 1 2 1 2 1 3 1 2 1 1
2542 4 4 24 1152 55 6622 1 NaN 1 CALLE ... 2 2 2 2 1 3 2 2 2 2
2548 4 4 82 110A 7 6628 1 NaN 1 CALLE ... 1 1 1 1 1 3 1 1 1 1
2705 5 9 28 0988 17 10437 8 EDUCADORA FRENTE AGRUPO 1 NINGUNO ... 2 2 1 2 1 2 1 2 2 1
2726 5 23 42 2470 13 10205 1 NaN 1 CAMINO ... 2 2 1 2 2 2 1 2 1 2
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
163208 30 174 123 0161 14 187519 1 NaN 1 CALLE ... 2 2 1 2 2 2 2 2 1 1
163260 30 32 79 0043 1 187759 1 NaN 1 LOCALIDAD ... 2 2 2 2 2 3 3 3 3 3
163569 30 143 324 0042 1 186120 1 NaN 1 CALLE ... 2 2 2 2 2 2 2 2 2 1
163769 30 169 31 0087 2 186661 2 NaN 1 CALLE ... 2 1 1 2 2 3 1 1 2 1
163833 30 169 64 0087 3 186671 1 NaN 1 NaN ... 2 1 2 1 1 3 2 2 1 1
163941 30 70 4 0059 11 189451 1 NaN 2 INDEPENDENCIA ... 2 2 2 2 2 3 2 2 2 2
163975 30 210 37 0244 8 189543 1 NaN 1 CALLE ... 2 2 2 2 1 2 2 2 2 2
164395 30 145 10 0013 6 188650 1 NaN 1 CALLE ... 2 1 2 2 2 2 2 2 1 2
164441 31 96 69 0562 6 193372 2 NaN 1 CALLE ... 1 2 1 2 1 3 2 1 2 2
164838 30 108 1 1130 7 188973 1 NaN 2 CALLE ... 2 2 2 2 2 2 2 2 2 2
164852 30 199 11 0014 1 188539 1 NaN 1 CALLE ... 2 2 1 2 2 3 2 2 1 2
164900 30 210 22 0244 5 189539 1 NaN 1 CALLE ... 2 1 1 2 2 2 2 3 1 2
165057 30 142 1 0238 3 188716 1 NaN 2 AVENIDA ... 2 1 1 2 1 3 3 3 2 1
165062 30 108 1 1198 16 188996 1 NaN 1 CALLE ... 1 1 1 1 1 2 1 2 1 1
165092 31 59 1 0520 15 190797 7 NaN 2 CALLE 27 ... 2 2 1 2 2 3 2 2 1 1
165094 31 59 1 0535 13 190799 1 NaN 2 CALLE 35 ... 1 2 1 1 1 2 1 1 1 1
165145 31 50 1 5009 19 191245 1 NaN 1 CALLE ... 1 1 1 2 1 3 2 2 1 1
165332 31 50 1 2413 7 191221 1 NaN 1 CALLE ... 1 1 1 1 1 3 2 2 1 2
165393 30 39 21 1428 27 189892 1 NaN 2 CALLE ... 1 2 2 2 2 2 2 2 1 1
165518 31 50 1 5066 27 191188 1 NaN 1 CALLE ... 1 1 1 1 1 2 2 2 1 9
165525 31 50 1 2451 22 191195 8 DIRECTOR ADMINISTRATIVO 1 CALLE ... 1 1 1 1 2 3 2 2 1 1
165529 31 50 1 2470 9 191199 8 COORDINADOR TECNOLOGICO 1 CARRETERA ... 1 1 1 2 2 3 1 1 1 2
165581 30 39 40 0256 7 190064 1 NaN 1 CALLE ... 1 1 1 1 1 2 1 1 2 2
165614 31 50 1 2714 29 191116 1 NaN 1 CALLE ... 1 1 1 1 1 3 2 2 1 1
165616 31 50 1 5865 22 191119 1 NaN 2 CALLE ... 1 1 1 1 1 2 2 2 1 2
165884 31 50 1 2220 16 191108 1 NaN 1 CALLE ... 1 1 1 1 2 2 1 1 2 2
165885 31 50 1 2235 6 191110 7 NaN 2 AVENIDA 7 ... 1 1 1 1 1 2 2 2 1 1
165953 31 59 1 0499 10 190789 1 NaN 2 CALLE ... 1 2 1 1 1 1 2 2 1 2
166026 31 50 1 1487 17 191263 8 SECRETARIA ADMINISTRATIVA 1 CALLE ... 1 1 1 1 1 3 1 2 1 2
166031 30 61 17 0223 1 190173 1 NaN 1 CARRETERA ... 2 2 1 2 2 2 1 1 1 1

2877 rows × 159 columns


In [14]:
#Transformaciones
##Diccionarios
p3_d = {1:,2:,3:,4:,5:}


Out[14]:
15042

In [45]:
df2['P11'].replace({0: 1, 1:1, 2:0},inplace=True)


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)

In [53]:
df2.ix[df2.P12<1, 'P12'] = 3
df2.ix[df2.P12>2, 'P12'] = 3
#df2[df2['P12']<1]['P12']


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s

In [54]:
df2['P12'].replace({1: 1.5, 1: 1, 3: 0},inplace=True)


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)

In [59]:
df2.ix[df2.P13A<1, 'P13A'] = 4
df2.ix[df2.P13A>4, 'P13A'] = 4
df2['P13A'].replace({1: 1.5, 2: 1, 3: 1, 4: 0},inplace=True)
#df2[df2['P13A']<1]['P13A']


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)

In [63]:
#df2.ix[df2.P14<1, 'P14'] = 3
df2.ix[df2.P14>3, 'P14'] = 3
df2['P14'].replace({1: 3, 2: 2, 3: 0},inplace=True)
#df2[df2['P14']<1]['P14']


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)

In [69]:
col='P15'
val = 4
df2.ix[df2.P15>val, col] = val
df2[col].replace({1: 3, 2: 2, 3: 2, 4: 0},inplace=True)
#print(max(df2[col]))
#print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)

In [71]:
col='P16'
val = 3
df2.ix[df2.P16>val, col] = val
df2[col].replace({1: 3, 2: 2, 3: 0},inplace=True)
#print(max(df2[col]))
#print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)

In [73]:
col='P17A'
val = 5
df2.ix[df2.P17A>val, col] = 4
df2[col].replace({1: 3, 2: 2, 3: 2, 4: 0, 5:1},inplace=True)
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
3.0
0.0

In [76]:
col='P18A'
val = 5
df2.ix[df2.P18A>val, col] = val
df2[col].replace({1: 3, 2: 2, 3: 2, 4: 1, 5:0},inplace=True)
print(max(df2[col]))
print(min(df2[col]))


3.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)

In [77]:
col='P19'
val = 2
df2.ix[df2.P19>val, col] = val
df2[col].replace({1: 1, 2: 0},inplace=True)
print(max(df2[col]))
print(min(df2[col]))


1.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)

In [78]:
col='P20'
val = 2
df2.ix[df2.P20>val, col] = val
df2[col].replace({1: 3, 2: 0},inplace=True)
print(max(df2[col]))
print(min(df2[col]))


3.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)

In [79]:
col='P21'
val = 2
df2.ix[df2.P21>val, col] = val
df2[col].replace({1: 3, 2: 0},inplace=True)
print(max(df2[col]))
print(min(df2[col]))


3.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)

In [80]:
col='P22'
val = 2
df2.ix[df2.P22>val, col] = val
df2[col].replace({1: 3, 2: 0},inplace=True)
print(max(df2[col]))
print(min(df2[col]))


3.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)

In [81]:
col='P23'
val = 2
df2.ix[df2.P23>val, col] = val
df2[col].replace({1: 5.5, 2: 0},inplace=True)
print(max(df2[col]))
print(min(df2[col]))


5.5
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)

In [83]:
col='P24'
val = 2
df2.ix[df2.P24>val, col] = val
df2[col].replace({1: 5.5, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
5.5
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [84]:
col='P25'
val = 2
df2.ix[df2.P25>val, col] = val
df2[col].replace({0: 0, 1: 0.5, 2: 1},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
1.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [85]:
col='P26'
val = 1
df2.ix[df2.P26>val, col] = val
#df2[col].replace({0: 0, 1: 1},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
1.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [86]:
col='P27'
val = 1
df2.ix[df2.P27>val, col] = val
#df2[col].replace({0: 0, 1: 1},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
1.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [87]:
col='P28'
val = 2
df2.ix[df2.P28>val, col] = val
df2[col].replace({0: 0.3, 1: 0, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
0.3
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [88]:
col='P29'
val = 2
df2.ix[df2.P29>val, col] = val
df2[col].replace({0: 0.3, 1: 0, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
0.3
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [89]:
col='P30'
val = 2
df2.ix[df2.P30>val, col] = val
df2[col].replace({0: 0.3, 1: 0, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
0.3
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [90]:
col='P31'
val = 2
df2.ix[df2.P31>val, col] = val
df2[col].replace({0: 0.3, 1: 0, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
0.3
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [91]:
col='P32'
val = 2
df2.ix[df2.P32>val, col] = val
df2[col].replace({0: 0.3, 1: 0, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
0.3
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [93]:
col='P33'
val = 2
df2.ix[df2.P33>val, col] = val
df2[col].replace({0: 0.5, 1: 0, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
0.5
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [94]:
col='P34'
val = 1
df2.ix[df2.P34>val, col] = val
#df2[col].replace({0: 0.3, 1: 0, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
1.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [95]:
col='P35'
val = 2
df2.ix[df2.P35>val, col] = val
df2[col].replace({0: 1.25, 1: 1, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
1.25
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [97]:
col='P36'
val = 1
df2.ix[df2.P36>val, col] = val
#df2[col].replace({0: 1.25, 1: 1, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
1.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [98]:
col='P37'
val = 2
df2.ix[df2.P37>val, col] = val
df2[col].replace({0: 1.25, 1: 1, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
1.25
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [99]:
col='P38'
val = 1
df2.ix[df2.P38>val, col] = val
#df2[col].replace({0: 1.25, 1: 1, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
1.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [100]:
col='P39'
val = 2
df2.ix[df2.P39>val, col] = val
df2[col].replace({0: 1.25, 1: 1, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
1.25
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [101]:
col='P40'
val = 1
df2.ix[df2.P40>val, col] = val
#df2[col].replace({0: 1.25, 1: 1, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


0
1.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [122]:
col='P41'
val = 2
df2.ix[df2.P41.isnull(), col] = 0
df2.ix[df2.P41>val, col] = val
df2[col].replace({0: 1.25, 1: 1, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
1.25
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [137]:
col='P42'
val = 3
df2.ix[df2.P42.isnull(), col] = 0
df2.ix[~(df2.P42>=val), col] = 0
df2.ix[df2.P42>=val, col] = 0.9

#df2[col].replace({0: 1.25, 1: 1, 2:0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)
0
0.9
0.0

In [138]:
col='P44'
val = 1
df2.ix[df2.P44.isnull(), col] = 0
df2.ix[df2.P44>val, col] = val
df2[col].replace({0: 0, 1: 0.8},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.8
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [139]:
col='P46'
val = 1
df2.ix[df2.P46.isnull(), col] = 0
df2.ix[df2.P46>val, col] = val
df2[col].replace({0: 0, 1: 0.8},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.8
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [140]:
col='P47'
val = 1
df2.ix[df2.P47.isnull(), col] = 0
df2.ix[df2.P47>val, col] = val
df2[col].replace({0: 0, 1: 0.8},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.8
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [141]:
col='P48'
val = 1
df2.ix[df2.P48.isnull(), col] = 0
df2.ix[df2.P48>val, col] = val
df2[col].replace({0: 0, 1: 0.8},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.8
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [142]:
col='P49'
val = 1
df2.ix[df2.P49.isnull(), col] = 0
df2.ix[df2.P49>val, col] = val
df2[col].replace({0: 0, 1: 0.8},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.8
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [143]:
col='P52'
val = 1
df2.ix[df2.P52.isnull(), col] = 0
df2.ix[df2.P52>val, col] = val
df2[col].replace({0: 2, 1: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
2.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [144]:
col='P62'
val = 1
df2.ix[df2.P62.isnull(), col] = 0
df2.ix[df2.P62>val, col] = val
df2[col].replace({0: 2, 1: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
2.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [145]:
col='P72'
val = 1
df2.ix[df2.P72.isnull(), col] = 0
df2.ix[df2.P72>val, col] = val
df2[col].replace({0: 2, 1: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
2.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [146]:
col='P82'
val = 1
df2.ix[df2.P82.isnull(), col] = 0
df2.ix[df2.P82>val, col] = val
df2[col].replace({0: 2, 1: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
2.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [147]:
col='P92'
val = 1
df2.ix[df2.P92.isnull(), col] = 0
df2.ix[df2.P92>val, col] = val
df2[col].replace({0: 2, 1: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
2.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [148]:
col='P102'
val = 2
df2.ix[df2.P102.isnull(), col] = 0
df2.ix[df2.P102>val, col] = val
df2[col].replace({1: .25, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.25
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [150]:
col='P112'
val = 2
df2.ix[df2.P112.isnull(), col] = 0
df2.ix[df2.P112>val, col] = val
df2[col].replace({1: .25, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.25
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [151]:
col='P113'
val = 2
df2.ix[df2.P113.isnull(), col] = 0
df2.ix[df2.P113>val, col] = val
df2[col].replace({1: .25, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.25
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [152]:
col='P117'
val = 2
df2.ix[df2.P117.isnull(), col] = 0
df2.ix[df2.P117>val, col] = val
df2[col].replace({1: .25, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.25
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [153]:
col='P122'
val = 2
df2.ix[df2.P122.isnull(), col] = 0
df2.ix[df2.P122>val, col] = val
df2[col].replace({1: .25, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.25
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [154]:
col='P123'
val = 2
df2.ix[df2.P123.isnull(), col] = 0
df2.ix[df2.P123>val, col] = val
df2[col].replace({1: .25, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.25
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [155]:
col='P125'
val = 2
df2.ix[df2.P125.isnull(), col] = 0
df2.ix[df2.P125>val, col] = val
df2[col].replace({1: .25, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.25
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [156]:
col='P126'
val = 1
df2.ix[df2.P126.isnull(), col] = 0
df2.ix[df2.P126>val, col] = val
df2[col].replace({0: 0, 1: 2},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
2.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [158]:
col='P133'
val = 2
df2.ix[df2.P133.isnull(), col] = 0
df2.ix[df2.P133>val, col] = val
df2[col].replace({1: 1.2, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
1.2
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [159]:
col='P134'
val = 2
df2.ix[df2.P134.isnull(), col] = 0
df2.ix[df2.P134>val, col] = val
df2[col].replace({1: 1.2, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
1.2
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [160]:
col='P135'
val = 2
df2.ix[df2.P135.isnull(), col] = 0
df2.ix[df2.P135>val, col] = val
df2[col].replace({1: 1.2, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
1.2
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [161]:
col='P136'
val = 2
df2.ix[df2.P136.isnull(), col] = 0
df2.ix[df2.P136>val, col] = val
df2[col].replace({1: 1.2, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
1.2
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [162]:
col='P137'
val = 2
df2.ix[df2.P137.isnull(), col] = 0
df2.ix[df2.P137>val, col] = val
df2[col].replace({1: 1.2, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
1.2
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [163]:
col='P138'
val = 2
df2.ix[df2.P138.isnull(), col] = 0
df2.ix[df2.P138>val, col] = val
df2[col].replace({1: 1.2, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
1.2
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [164]:
col='P139'
val = 2
df2.ix[df2.P139.isnull(), col] = 0
df2.ix[df2.P139>val, col] = val
df2[col].replace({1: 1.2, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
1.2
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [165]:
col='P140'
val = 2
df2.ix[df2.P140.isnull(), col] = 0
df2.ix[df2.P140>val, col] = val
df2[col].replace({1: 1.2, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
1.2
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [167]:
col='P141'
val = 2
df2.ix[df2.P141.isnull(), col] = 0
df2.ix[df2.P141>val, col] = val
df2[col].replace({1: 0.4, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.4
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [168]:
col='P142'
val = 2
df2.ix[df2.P142.isnull(), col] = 0
df2.ix[df2.P142>val, col] = val
df2[col].replace({1: 0.5, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.5
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [169]:
col='P143'
val = 2
df2.ix[df2.P143.isnull(), col] = 0
df2.ix[df2.P143>val, col] = val
df2[col].replace({1: 0.5, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
0.5
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [170]:
col='P144'
val = 2
df2.ix[df2.P144.isnull(), col] = 0
df2.ix[df2.P144>val, col] = val
df2[col].replace({1: 4, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
4.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [171]:
col='P145'
val = 2
df2.ix[df2.P145.isnull(), col] = 0
df2.ix[df2.P145>val, col] = val
df2[col].replace({1: 4, 2: 0},inplace=True)
print(len(df2[df[col]<0]))
print(max(df2[col]))
print(min(df2[col]))


/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/indexing.py:420: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self.obj[item] = s
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/generic.py:3005: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  self._update_inplace(new_data)
0
4.0
0.0
/Users/luis/anaconda/lib/python3.4/site-packages/pandas/core/frame.py:1942: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  "DataFrame index.", UserWarning)

In [172]:
df2.to_csv('infraestuctura.csv')

In [ ]: