"El tipo de dato mas importante de numpy es **numpy.array** sus atibutos mas importantes son:\n",
"El tipo de dato mas importante de numpy es **numpy.array** sus atibutos mas importantes son:\n",
"* numpy.array.**ndim**: -numero de dimensiones del arreglo.\n",
"* numpy.array.**ndim**: -numero de dimensiones del arreglo.\n",
"* numpy.array.**shape**: Un tumpla indicando el tamaño del arreglo en cada dimension.\n",
"* numpy.array.**shape**: Un tupla indicando el tamaño del arreglo en cada dimension.\n",
"* numpy.array.**size**: El numero total elementos en el arreglo.\n",
"* numpy.array.**size**: El numero total elementos en el arreglo.\n",
"* numpy.array.**dtype**: El tipo de elemenos en el arreglo e.g. numpy.int32, numpy.int16, and numpy.float64.\n",
"* numpy.array.**dtype**: El tipo de elemenos en el arreglo e.g. numpy.int32, numpy.int16, and numpy.float64.\n",
"* numpy.array.**itemsize**: el tamaño en bytes de cada elemento del arrglo.\n",
"* numpy.array.**itemsize**: el tamaño en bytes de cada elemento del arrglo.\n",
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 5,
"execution_count": 1,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 6,
"execution_count": 2,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
" [3.+0.j, 4.+0.j]])"
" [3.+0.j, 4.+0.j]])"
]
]
},
},
"execution_count": 6,
"execution_count": 2,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -75,7 +75,7 @@
...
@@ -75,7 +75,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 7,
"execution_count": 3,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -86,7 +86,7 @@
...
@@ -86,7 +86,7 @@
" [0., 0., 0., 0.]])"
" [0., 0., 0., 0.]])"
]
]
},
},
"execution_count": 7,
"execution_count": 3,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -98,7 +98,7 @@
...
@@ -98,7 +98,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 8,
"execution_count": 4,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -109,7 +109,7 @@
...
@@ -109,7 +109,7 @@
" [1., 1., 1., 1.]])"
" [1., 1., 1., 1.]])"
]
]
},
},
"execution_count": 8,
"execution_count": 4,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -120,7 +120,7 @@
...
@@ -120,7 +120,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 9,
"execution_count": 5,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -131,7 +131,7 @@
...
@@ -131,7 +131,7 @@
" [1., 1., 1., 1.]])"
" [1., 1., 1., 1.]])"
]
]
},
},
"execution_count": 9,
"execution_count": 5,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -142,7 +142,7 @@
...
@@ -142,7 +142,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 39,
"execution_count": 6,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -155,7 +155,7 @@
...
@@ -155,7 +155,7 @@
" [0., 0., 0., 0., 1.]])"
" [0., 0., 0., 0., 1.]])"
]
]
},
},
"execution_count": 39,
"execution_count": 6,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -173,7 +173,7 @@
...
@@ -173,7 +173,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 10,
"execution_count": 7,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
...
@@ -183,7 +183,7 @@
...
@@ -183,7 +183,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 11,
"execution_count": 8,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -192,7 +192,7 @@
...
@@ -192,7 +192,7 @@
"array([20, 29, 38, 47])"
"array([20, 29, 38, 47])"
]
]
},
},
"execution_count": 11,
"execution_count": 8,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -204,7 +204,7 @@
...
@@ -204,7 +204,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 12,
"execution_count": 9,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -213,19 +213,19 @@
...
@@ -213,19 +213,19 @@
"array([ 40, 60, 80, 100])"
"array([ 40, 60, 80, 100])"
]
]
},
},
"execution_count": 12,
"execution_count": 9,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"# Multiplicacion Por escalar\n",
"# Multiplicacion por Escalar\n",
"a*2"
"a*2"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 13,
"execution_count": 10,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
"array([0, 1, 4, 9])"
"array([0, 1, 4, 9])"
]
]
},
},
"execution_count": 13,
"execution_count": 10,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -246,7 +246,7 @@
...
@@ -246,7 +246,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 14,
"execution_count": 11,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -255,7 +255,7 @@
...
@@ -255,7 +255,7 @@
"array([ True, True, True, False])"
"array([ True, True, True, False])"
]
]
},
},
"execution_count": 14,
"execution_count": 11,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -267,7 +267,7 @@
...
@@ -267,7 +267,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 15,
"execution_count": 12,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -276,7 +276,7 @@
...
@@ -276,7 +276,7 @@
"array([ 0, 30, 80, 150])"
"array([ 0, 30, 80, 150])"
]
]
},
},
"execution_count": 15,
"execution_count": 12,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -286,135 +286,135 @@
...
@@ -286,135 +286,135 @@
"a*b"
"a*b"
]
]
},
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[**Producto punto**](https://en.wikipedia.org/wiki/Dot_product) y [**Multiplicacion Matricial**](https://en.wikipedia.org/wiki/Matrix_multiplication)"
]
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 16,
"execution_count": 13,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"True"
"66"
]
]
},
},
"execution_count": 16,
"execution_count": 13,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"a@b == a.dot(b)"
"c= np.arange(12).reshape(3,4)\n",
]
"c.sum()"
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"a = np.array([[1, 0], [0, 1]])\n",
"b = np.array([[4, 1], [2, 2]]) "
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 18,
"execution_count": 14,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"array([[ True, True],\n",
"array([12, 15, 18, 21])"
" [ True, True]])"
]
]
},
},
"execution_count": 18,
"execution_count": 14,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"np.matmul(a, b) == a.dot(b)\n"
"c.sum(axis=0) # Suma por Columna"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 19,
"execution_count": 15,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"66"
"array([ 6, 22, 38])"
]
]
},
},
"execution_count": 19,
"execution_count": 15,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"c= np.arange(12).reshape(3,4)\n",
"c.sum(axis=1) #Suma por Fila"
"c.sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[**Producto punto**](https://en.wikipedia.org/wiki/Dot_product) y [**Multiplicacion Matricial**](https://en.wikipedia.org/wiki/Matrix_multiplication)"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 20,
"execution_count": 16,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"array([12, 15, 18, 21])"
"True"
]
]
},
},
"execution_count": 20,
"execution_count": 16,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"c.sum(axis=0) # Suma por Columna"
"a@b == a.dot(b)"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 21,
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"A = np.array([[1, 0], [0, 1]])\n",
"B = np.array([[4, 1], [2, 2]]) "
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"array([ 6, 22, 38])"
"array([[ True, True],\n",
" [ True, True]])"
]
]
},
},
"execution_count": 21,
"execution_count": 18,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"c.sum(axis=1) #Suma por Fila"
"np.matmul(A, B) == A.dot(B)\n"
]
]
},
},
{
{
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {},
"metadata": {},
"source": [
"source": [
"### Elementos, filas, columnas y subarreglos."
"### Elementos, filas, columnas y submatrices."
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 22,
"execution_count": 19,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -427,7 +427,7 @@
...
@@ -427,7 +427,7 @@
" [40, 41, 42, 43]])"
" [40, 41, 42, 43]])"
]
]
},
},
"execution_count": 22,
"execution_count": 19,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -435,13 +435,13 @@
...
@@ -435,13 +435,13 @@
"source": [
"source": [
"def f(x,y):\n",
"def f(x,y):\n",
" return 10*x+y\n",
" return 10*x+y\n",
"b = np.fromfunction(f,(5,4),dtype=int)\n",
"B = np.fromfunction(f,(5,4),dtype=int)\n",
"b"
"B"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 23,
"execution_count": 20,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -450,18 +450,18 @@
...
@@ -450,18 +450,18 @@
"3"
"3"
]
]
},
},
"execution_count": 23,
"execution_count": 20,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"b[0,3]"
"B[0,3]"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 24,
"execution_count": 21,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -470,18 +470,18 @@
...
@@ -470,18 +470,18 @@
"array([10, 11, 12, 13])"
"array([10, 11, 12, 13])"
]
]
},
},
"execution_count": 24,
"execution_count": 21,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"b[1,:]"
"B[1,:]"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 25,
"execution_count": 22,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -490,18 +490,18 @@
...
@@ -490,18 +490,18 @@
"array([ 1, 11, 21, 31, 41])"
"array([ 1, 11, 21, 31, 41])"
]
]
},
},
"execution_count": 25,
"execution_count": 22,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"b[:,1]"
"B[:,1]"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 26,
"execution_count": 23,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -511,13 +511,13 @@
...
@@ -511,13 +511,13 @@
" [11, 12]])"
" [11, 12]])"
]
]
},
},
"execution_count": 26,
"execution_count": 23,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"b[:2,1:3]"
"B[:2,1:3]"
]
]
},
},
{
{
...
@@ -529,7 +529,7 @@
...
@@ -529,7 +529,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 27,
"execution_count": 24,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -545,13 +545,13 @@
...
@@ -545,13 +545,13 @@
}
}
],
],
"source": [
"source": [
"for row in b:\n",
"for row in B:\n",
" print(row)"
" print(row)"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 28,
"execution_count": 25,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -582,7 +582,7 @@
...
@@ -582,7 +582,7 @@
}
}
],
],
"source": [
"source": [
"for element in b.flat:\n",
"for element in B.flat:\n",
" print(element)"
" print(element)"
]
]
},
},
...
@@ -595,18 +595,18 @@
...
@@ -595,18 +595,18 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 29,
"execution_count": 26,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"array([[8., 0., 8., 9.],\n",
"array([[2., 2., 9., 4.],\n",
" [6., 1., 5., 9.],\n",
" [6., 6., 3., 6.],\n",
" [9., 3., 3., 2.]])"
" [7., 9., 9., 8.]])"
]
]
},
},
"execution_count": 29,
"execution_count": 26,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -618,7 +618,7 @@
...
@@ -618,7 +618,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 30,
"execution_count": 27,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -627,7 +627,7 @@
...
@@ -627,7 +627,7 @@
"(3, 4)"
"(3, 4)"
]
]
},
},
"execution_count": 30,
"execution_count": 27,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -638,21 +638,21 @@
...
@@ -638,21 +638,21 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 31,
"execution_count": 28,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"array([[8., 0.],\n",
"array([[2., 2.],\n",
" [8., 9.],\n",
" [9., 4.],\n",
" [6., 1.],\n",
" [6., 6.],\n",
" [5., 9.],\n",
" [3., 6.],\n",
" [9., 3.],\n",
" [7., 9.],\n",
" [3., 2.]])"
" [9., 8.]])"
]
]
},
},
"execution_count": 31,
"execution_count": 28,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -663,19 +663,19 @@
...
@@ -663,19 +663,19 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 32,
"execution_count": 29,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"array([[8., 6., 9.],\n",
"array([[2., 6., 7.],\n",
" [0., 1., 3.],\n",
" [2., 6., 9.],\n",
" [8., 5., 3.],\n",
" [9., 3., 9.],\n",
" [9., 9., 2.]])"
" [4., 6., 8.]])"
]
]
},
},
"execution_count": 32,
"execution_count": 29,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -686,7 +686,7 @@
...
@@ -686,7 +686,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 33,
"execution_count": 30,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -698,7 +698,7 @@
...
@@ -698,7 +698,7 @@
" [ True, True, True]])"
" [ True, True, True]])"
]
]
},
},
"execution_count": 33,
"execution_count": 30,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -709,7 +709,7 @@
...
@@ -709,7 +709,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 34,
"execution_count": 31,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -718,7 +718,7 @@
...
@@ -718,7 +718,7 @@
"(4, 3)"
"(4, 3)"
]
]
},
},
"execution_count": 34,
"execution_count": 31,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -729,24 +729,24 @@
...
@@ -729,24 +729,24 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 35,
"execution_count": 32,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"array([[8., 0., 8., 9.],\n",
"array([[2., 2., 9., 4.],\n",
" [6., 1., 5., 9.],\n",
" [6., 6., 3., 6.],\n",
" [9., 3., 3., 2.]])"
" [7., 9., 9., 8.]])"
]
]
},
},
"execution_count": 35,
"execution_count": 32,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"# La dimencion con -1 se calcula automaticamente\n",
"# La dimensión con -1 se calcula automaticamente\n",
"a.reshape(3,-1)"
"a.reshape(3,-1)"
]
]
},
},
...
@@ -761,7 +761,7 @@
...
@@ -761,7 +761,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 36,
"execution_count": 33,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
...
@@ -778,7 +778,7 @@
...
@@ -778,7 +778,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 37,
"execution_count": 34,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
...
@@ -840,7 +840,7 @@
...
@@ -840,7 +840,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 41,
"execution_count": 35,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
...
@@ -850,21 +850,21 @@
...
@@ -850,21 +850,21 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 51,
"execution_count": 36,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"a 0.994272\n",
"a -0.192610\n",
"b 0.530519\n",
"b 0.957230\n",
"c 1.162452\n",
"c -0.917233\n",
"d -0.981436\n",
"d 1.156523\n",
"e -1.283798\n",
"e -0.539532\n",
"dtype: float64"
"dtype: float64"
]
]
},
},
"execution_count": 51,
"execution_count": 36,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -876,21 +876,21 @@
...
@@ -876,21 +876,21 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 46,
"execution_count": 37,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"0 2.042498\n",
"0 -0.856313\n",
"1 -0.964070\n",
"1 -0.342923\n",
"2 -0.687132\n",
"2 -1.398583\n",
"3 0.623300\n",
"3 0.170869\n",
"4 1.366322\n",
"4 1.049196\n",
"dtype: float64"
"dtype: float64"
]
]
},
},
"execution_count": 46,
"execution_count": 37,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -901,7 +901,7 @@
...
@@ -901,7 +901,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 47,
"execution_count": 38,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -913,7 +913,7 @@
...
@@ -913,7 +913,7 @@
"dtype: int64"
"dtype: int64"
]
]
},
},
"execution_count": 47,
"execution_count": 38,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -925,7 +925,7 @@
...
@@ -925,7 +925,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 48,
"execution_count": 39,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -938,7 +938,7 @@
...
@@ -938,7 +938,7 @@
"dtype: float64"
"dtype: float64"
]
]
},
},
"execution_count": 48,
"execution_count": 39,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -957,16 +957,16 @@
...
@@ -957,16 +957,16 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 53,
"execution_count": 40,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"0.9942721192063438"
"-0.19261011238315226"
]
]
},
},
"execution_count": 53,
"execution_count": 40,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -977,19 +977,19 @@
...
@@ -977,19 +977,19 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 54,
"execution_count": 41,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"a 0.994272\n",
"a -0.192610\n",
"b 0.530519\n",
"b 0.957230\n",
"c 1.162452\n",
"c -0.917233\n",
"dtype: float64"
"dtype: float64"
]
]
},
},
"execution_count": 54,
"execution_count": 41,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1000,19 +1000,18 @@
...
@@ -1000,19 +1000,18 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 55,
"execution_count": 42,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"a 0.994272\n",
"b 0.957230\n",
"b 0.530519\n",
"d 1.156523\n",
"c 1.162452\n",
"dtype: float64"
"dtype: float64"
]
]
},
},
"execution_count": 55,
"execution_count": 42,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1023,21 +1022,21 @@
...
@@ -1023,21 +1022,21 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 56,
"execution_count": 43,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"a 1.988544\n",
"a -0.385220\n",
"b 1.061037\n",
"b 1.914460\n",
"c 2.324904\n",
"c -1.834466\n",
"d -1.962872\n",
"d 2.313046\n",
"e -2.567597\n",
"e -1.079065\n",
"dtype: float64"
"dtype: float64"
]
]
},
},
"execution_count": 56,
"execution_count": 43,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1048,21 +1047,21 @@
...
@@ -1048,21 +1047,21 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 57,
"execution_count": 44,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"a True\n",
"a False\n",
"b False\n",
"b True\n",
"c True\n",
"c False\n",
"d False\n",
"d True\n",
"e False\n",
"e False\n",
"dtype: bool"
"dtype: bool"
]
]
},
},
"execution_count": 57,
"execution_count": 44,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1073,16 +1072,16 @@
...
@@ -1073,16 +1072,16 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 58,
"execution_count": 45,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"0.9942721192063438"
"-0.19261011238315226"
]
]
},
},
"execution_count": 58,
"execution_count": 45,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1100,7 +1099,7 @@
...
@@ -1100,7 +1099,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 59,
"execution_count": 46,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
...
@@ -1110,7 +1109,7 @@
...
@@ -1110,7 +1109,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 60,
"execution_count": 47,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -1119,7 +1118,7 @@
...
@@ -1119,7 +1118,7 @@
"array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])"
"array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])"
]
]
},
},
"execution_count": 60,
"execution_count": 47,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1130,7 +1129,7 @@
...
@@ -1130,7 +1129,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 62,
"execution_count": 48,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -1149,7 +1148,7 @@
...
@@ -1149,7 +1148,7 @@
"dtype: int64"
"dtype: int64"
]
]
},
},
"execution_count": 62,
"execution_count": 48,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1160,7 +1159,7 @@
...
@@ -1160,7 +1159,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 75,
"execution_count": 49,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -1169,7 +1168,7 @@
...
@@ -1169,7 +1168,7 @@
"array([ 4, 6, 8, 10, 12, 14])"
"array([ 4, 6, 8, 10, 12, 14])"
]
]
},
},
"execution_count": 75,
"execution_count": 49,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1180,7 +1179,7 @@
...
@@ -1180,7 +1179,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 76,
"execution_count": 50,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -1199,7 +1198,7 @@
...
@@ -1199,7 +1198,7 @@
"dtype: float64"
"dtype: float64"
]
]
},
},
"execution_count": 76,
"execution_count": 50,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1208,6 +1207,718 @@
...
@@ -1208,6 +1207,718 @@
"(s[:6]+s[4:])"
"(s[:6]+s[4:])"
]
]
},
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 5.3.2 DataFrame\n",
"DataFrame es un estructura bidimensiona etiquetada con columnas que pueden ser de diferentes tipos, es el objeto mas usado en pandas, se puede pensar en ella como un diccionario de **Series**. **DataFrame** acepta diferentes tipos de entradas como:\n",
"* Diccionarios de arreglos unidimensionales, listas dicionarios o series. \n",