"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",
...
@@ -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"
}
}
...
@@ -194,7 +194,7 @@
...
@@ -194,7 +194,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 11,
"execution_count": 8,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -203,7 +203,7 @@
...
@@ -203,7 +203,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"
}
}
...
@@ -215,7 +215,7 @@
...
@@ -215,7 +215,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 12,
"execution_count": 9,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -224,19 +224,19 @@
...
@@ -224,19 +224,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": [
{
{
...
@@ -245,7 +245,7 @@
...
@@ -245,7 +245,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"
}
}
...
@@ -257,7 +257,7 @@
...
@@ -257,7 +257,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 14,
"execution_count": 11,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -266,7 +266,7 @@
...
@@ -266,7 +266,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"
}
}
...
@@ -278,7 +278,7 @@
...
@@ -278,7 +278,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 15,
"execution_count": 12,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -287,7 +287,7 @@
...
@@ -287,7 +287,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"
}
}
...
@@ -297,135 +297,135 @@
...
@@ -297,135 +297,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": [
{
{
...
@@ -438,7 +438,7 @@
...
@@ -438,7 +438,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"
}
}
...
@@ -446,13 +446,13 @@
...
@@ -446,13 +446,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": [
{
{
...
@@ -461,18 +461,18 @@
...
@@ -461,18 +461,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": [
{
{
...
@@ -481,18 +481,18 @@
...
@@ -481,18 +481,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": [
{
{
...
@@ -501,18 +501,18 @@
...
@@ -501,18 +501,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": [
{
{
...
@@ -522,13 +522,13 @@
...
@@ -522,13 +522,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]"
]
]
},
},
{
{
...
@@ -540,7 +540,7 @@
...
@@ -540,7 +540,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 27,
"execution_count": 24,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -556,13 +556,13 @@
...
@@ -556,13 +556,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": [
{
{
...
@@ -593,7 +593,7 @@
...
@@ -593,7 +593,7 @@
}
}
],
],
"source": [
"source": [
"for element in b.flat:\n",
"for element in B.flat:\n",
" print(element)"
" print(element)"
]
]
},
},
...
@@ -606,18 +606,18 @@
...
@@ -606,18 +606,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"
}
}
...
@@ -629,7 +629,7 @@
...
@@ -629,7 +629,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 30,
"execution_count": 27,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -638,7 +638,7 @@
...
@@ -638,7 +638,7 @@
"(3, 4)"
"(3, 4)"
]
]
},
},
"execution_count": 30,
"execution_count": 27,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -649,21 +649,21 @@
...
@@ -649,21 +649,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"
}
}
...
@@ -674,19 +674,19 @@
...
@@ -674,19 +674,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"
}
}
...
@@ -697,7 +697,7 @@
...
@@ -697,7 +697,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 33,
"execution_count": 30,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -709,7 +709,7 @@
...
@@ -709,7 +709,7 @@
" [ True, True, True]])"
" [ True, True, True]])"
]
]
},
},
"execution_count": 33,
"execution_count": 30,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -720,7 +720,7 @@
...
@@ -720,7 +720,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 34,
"execution_count": 31,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -729,7 +729,7 @@
...
@@ -729,7 +729,7 @@
"(4, 3)"
"(4, 3)"
]
]
},
},
"execution_count": 34,
"execution_count": 31,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -740,24 +740,24 @@
...
@@ -740,24 +740,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)"
]
]
},
},
...
@@ -772,7 +772,7 @@
...
@@ -772,7 +772,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 17,
"execution_count": 33,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -802,7 +802,7 @@
...
@@ -802,7 +802,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 23,
"execution_count": 34,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -924,7 +924,7 @@
...
@@ -924,7 +924,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 41,
"execution_count": 35,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
...
@@ -934,21 +934,21 @@
...
@@ -934,21 +934,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"
}
}
...
@@ -960,21 +960,21 @@
...
@@ -960,21 +960,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"
}
}
...
@@ -985,7 +985,7 @@
...
@@ -985,7 +985,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 47,
"execution_count": 38,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -997,7 +997,7 @@
...
@@ -997,7 +997,7 @@
"dtype: int64"
"dtype: int64"
]
]
},
},
"execution_count": 47,
"execution_count": 38,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1009,7 +1009,7 @@
...
@@ -1009,7 +1009,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 48,
"execution_count": 39,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -1022,7 +1022,7 @@
...
@@ -1022,7 +1022,7 @@
"dtype: float64"
"dtype: float64"
]
]
},
},
"execution_count": 48,
"execution_count": 39,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1041,16 +1041,16 @@
...
@@ -1041,16 +1041,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"
}
}
...
@@ -1061,19 +1061,19 @@
...
@@ -1061,19 +1061,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"
}
}
...
@@ -1084,19 +1084,18 @@
...
@@ -1084,19 +1084,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"
}
}
...
@@ -1107,21 +1106,21 @@
...
@@ -1107,21 +1106,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"
}
}
...
@@ -1132,21 +1131,21 @@
...
@@ -1132,21 +1131,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"
}
}
...
@@ -1157,16 +1156,16 @@
...
@@ -1157,16 +1156,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"
}
}
...
@@ -1184,7 +1183,7 @@
...
@@ -1184,7 +1183,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 59,
"execution_count": 46,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
...
@@ -1194,7 +1193,7 @@
...
@@ -1194,7 +1193,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 60,
"execution_count": 47,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -1203,7 +1202,7 @@
...
@@ -1203,7 +1202,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"
}
}
...
@@ -1214,7 +1213,7 @@
...
@@ -1214,7 +1213,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 62,
"execution_count": 48,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -1233,7 +1232,7 @@
...
@@ -1233,7 +1232,7 @@
"dtype: int64"
"dtype: int64"
]
]
},
},
"execution_count": 62,
"execution_count": 48,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1244,7 +1243,7 @@
...
@@ -1244,7 +1243,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 75,
"execution_count": 49,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -1253,7 +1252,7 @@
...
@@ -1253,7 +1252,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"
}
}
...
@@ -1264,7 +1263,7 @@
...
@@ -1264,7 +1263,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 76,
"execution_count": 50,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -1283,7 +1282,7 @@
...
@@ -1283,7 +1282,7 @@
"dtype: float64"
"dtype: float64"
]
]
},
},
"execution_count": 76,
"execution_count": 50,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1292,6 +1291,739 @@
...
@@ -1292,6 +1291,739 @@
"(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",