{"cells":[{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\n# Creamos las categorias\nsexo=['M','F','Otro']\nestatura= ['<150cm','150-170cm','170-190cm','>190cm']\ncabello=['Corto','Mediano (hasta orejas)','Largo (supera hombros)']\ncolor=['Rojo','Rubio','CastaƱo','Negro','Otro']\ndelineador=['Si','No']","metadata":{"id":"otEDvDjUmvXP","cell_id":"8666752ffe9646b784babf8c4499ba61","executionInfo":{"user":{"userId":"09471607480253994520","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":676,"user_tz":180,"timestamp":1650200830363},"deepnote_cell_type":"code"},"outputs":[],"execution_count":1},{"cell_type":"code","source":"# Creacion de datos artificiales\nv_sexo=np.random.choice(sexo, 1000)\nv_estatura=np.random.choice(estatura, 1000)\nv_cabello=np.random.choice(cabello, 1000)\nv_color=np.random.choice(color, 1000)\n#v_delineador=np.random.choice(delineador, 100)","metadata":{"id":"7ydtJZItojkD","cell_id":"d656507654c44b7498b14c315a180df2","executionInfo":{"user":{"userId":"09471607480253994520","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":370,"user_tz":180,"timestamp":1650202610281},"deepnote_cell_type":"code"},"outputs":[],"execution_count":51},{"cell_type":"code","source":"# Creacion del dataframe\ndf=pd.DataFrame()\ndf['Sexo']=v_sexo \ndf['Estatura']=v_estatura\ndf['Cabello']=v_cabello\ndf['Color']=v_color\ndf['Delineador'] = np.where(((df['Sexo']=='F') & ((df['Estatura'] == '<150cm')|(df['Estatura'] == '150-170cm'))) | \n ((df['Sexo']=='M') & ((df['Estatura'] == '150-170cm')|(df['Estatura'] == '>190cm'))), \n 'Si', 'No')\n\ndf.head()","metadata":{"id":"p6VEFNkdo9Qw","colab":{"height":206,"base_uri":"https://localhost:8080/"},"cell_id":"c05db57fe0c144808efbab8aee0b8dbd","outputId":"52365f3e-d01a-4be1-8673-164dfdb86cfc","executionInfo":{"user":{"userId":"09471607480253994520","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":317,"user_tz":180,"timestamp":1650203201139},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":" Sexo Estatura Cabello Color Delineador\n0 Otro 150-170cm Corto Rojo No\n1 M >190cm Largo (supera hombros) Otro Si\n2 Otro 170-190cm Largo (supera hombros) Negro No\n3 Otro >190cm Largo (supera hombros) Rojo No\n4 Otro >190cm Corto Rojo No","text/html":"\n
\n | Sexo | \nEstatura | \nCabello | \nColor | \nDelineador | \n
---|---|---|---|---|---|
0 | \nOtro | \n150-170cm | \nCorto | \nRojo | \nNo | \n
1 | \nM | \n>190cm | \nLargo (supera hombros) | \nOtro | \nSi | \n
2 | \nOtro | \n170-190cm | \nLargo (supera hombros) | \nNegro | \nNo | \n
3 | \nOtro | \n>190cm | \nLargo (supera hombros) | \nRojo | \nNo | \n
4 | \nOtro | \n>190cm | \nCorto | \nRojo | \nNo | \n