No tienes acceso a esta clase

¡Continúa aprendiendo! Únete y comienza a potenciar tu carrera

Apache Spark: acciones

10/25
Recursos

Aportes 12

Preguntas 0

Ordenar por:

¿Quieres ver más aportes, preguntas y respuestas de la comunidad?

Mi respuesta a la tarea: ![](https://static.platzi.com/media/user_upload/Captura%20de%20pantalla%202024-03-29%20215251-32a0385f-1b56-419f-8868-d752f7104402.jpg)![](https://static.platzi.com/media/user_upload/Captura%20de%20pantalla%202024-03-29%20215306-963de59b-4edb-4a77-88ae-79624f779193.jpg)
MI tarea: ![](https://static.platzi.com/media/user_upload/image-7b756fb6-5e9a-4194-b86d-1765c515c877.jpg)![](https://static.platzi.com/media/user_upload/image-86bc22e8-915d-4f1d-aa5b-cf775c2fcbba.jpg) ![](https://static.platzi.com/media/user_upload/image-93ea192e-a326-4b5e-b60c-38963d99e3df.jpg)
Asi lo resolvi: ![](https://static.platzi.com/media/user_upload/image-340f94b7-43de-4c3f-9eed-e59e1ec40bcd.jpg) ![](https://static.platzi.com/media/user_upload/image-a712691b-7f43-451b-a27e-1ab2ae402241.jpg)
`# ejerciciolista_nros = [1,2,3,4,5,6,7,8,9,10]rdd_homework = sc.parallelize(lista_nros)rdd_homework.collect()#print (f'el RRD esta compuesto por: {rdd_homework}')rdd_par =  rdd_homework.filter( lambda x : x % 2 == 0) #filtro para obtener los numeros pares.rdd_par.collect()# maximos y minimos rdd_max = rdd_homework.max()rdd_min = rdd_homework.min()print  (f'el maximo es {rdd_max} y el minimo es {rdd_min}')rdd_sumavg = rdd_max + rdd_minrdd_avg = rdd_sumavg / 2print(f'el promedio es: {rdd_avg}')# calculando promedio de la lista de numeros con meanrdd_avg = rdd_homework.mean()print(f'el promedio es: {rdd_avg}')# uniendo dos RDDslista_nrostwo = [1,3,5,7,9,11,13,15,17,19,21]rdd_homeworktwo = sc.parallelize(lista_nrostwo)rdd_homeworktwo.collect()` `rdd_join = rdd_homework.union(rdd_homeworktwo)rdd_join.collect()`
![](https://static.platzi.com/media/user_upload/image-f601737e-4e06-40ea-b277-074629245f73.jpg) ![](https://static.platzi.com/media/user_upload/image-16eaa869-0f93-4c7b-b371-88482742655c.jpg) Done!
Mis respuestas: ![](https://static.platzi.com/media/user_upload/image-851a764a-c145-4e62-ae7f-9a9d4fb7090f.jpg) ![](https://static.platzi.com/media/user_upload/image-250877f2-8fe3-4845-b847-1305b6d18dbb.jpg) ![](https://static.platzi.com/media/user_upload/image-d32f02bf-0ba8-4831-9e06-d63f078c1f61.jpg) ![](https://static.platzi.com/media/user_upload/image-04379eb0-1a88-4c0c-8a1f-f5500163c2b9.jpg) ![](https://static.platzi.com/media/user_upload/image-fadd5d49-f39e-4433-a46c-c969d9c173c5.jpg)
I am a fan of these exercises![](https://static.platzi.com/media/user_upload/image-36490e4c-085d-4d2f-8905-24da2b119107.jpg)![](https://static.platzi.com/media/user_upload/image-1fb1b980-3037-4d9d-a487-53039236259a.jpg)![](https://static.platzi.com/media/user_upload/image-5d3046ff-36e7-4c9d-bd42-8361f90c9568.jpg)
Hola! Comparto mi solución al reto: ![](https://static.platzi.com/media/user_upload/image-6c7181b8-33c1-4784-8e81-de9d8f1879a8.jpg)![](https://static.platzi.com/media/user_upload/image-b9578ae2-fe37-4a2f-9fb9-6a0ce17010a7.jpg)![](https://static.platzi.com/media/user_upload/image-8eaa4a21-f453-4061-a04d-ca13e8bffcf3.jpg)
```python #Create a RDD list_1_10 = [1,2,3,4,5,6,7,8,9,10] list_rdd = sc.parallelize(list_1_10) list_rdd.collect() #Filter pair values pair_values = list_rdd.filter(lambda x : x % 2 == 0) pair_values.collect() #Find Max and Min in the list display("The max number of the list is:",list_rdd.max(), "The min number of the list is:",list_rdd.min()) #Find the average of the list display("The average of the list is:", list_rdd.mean()) #Join RDDs join_rdd = list_rdd.union(pair_values) join_rdd.collect() ```#Create a RDDlist\_1\_10 = \[1,2,3,4,5,6,7,8,9,10] list\_rdd = sc.parallelize(list\_1\_10)list\_rdd.collect()
![](https://static.platzi.com/media/user_upload/image-ae3687b7-1caa-450e-86bd-904f3b21653e.jpg) ![](https://static.platzi.com/media/user_upload/image-d700a97f-9e6e-4120-a696-3c2562c16d08.jpg)![]() ![]()solo me faltó el AVG ☺️
Vi en los comentarios que para unir se usa la funcion "Union" pero al intentarlo de la siguiente manera tambien funcionó. Es correcto? ![](https://static.platzi.com/media/user_upload/image-d509877d-92ce-467a-b136-a418987031ca.jpg)
Comparto mi solución al reto de la clase: ![](https://static.platzi.com/media/user_upload/image-5f10b627-8aba-4a78-962d-2b01803c6e2d.jpg) ![]()![](https://static.platzi.com/media/user_upload/image-ae6564b8-3785-4ac6-846d-06348628c682.jpg) ![]()![]()![]()![](https://static.platzi.com/media/user_upload/image-105b0942-9d56-4a91-9185-ad34b98cabe7.jpg)