mapPartitions and mappartitionswithindex

Hello guys GM.

I want to understand how mapPartition and mapPartitonWithIndex works pratical. Theoretical i understood what happens internally.
How can the below map function be applied with mapPartition and mapPartitionWithIndex.

val NAS = sc.parallelize(List( (“Deeapak” , “male”, 4000), (“Deepak” , “male”, 2000), (“Deepika” , “female”, 2000),(“Deepak” , “female”, 2000), (“Deepak” , “male”, 1000) , (“Neeta” , “female”, 2000)))
val NASMap = NAS.map(x => ((x._1,x._2),(x._3)))

Thanks
Jugal