pyspark partitioning data using partitionby
I recently used partitionby. What I did was restructure my data so that all those which I want to put in same partition have the same key, which in turn is a value from the data. my data was a list of dictionary, which I converted into tupples with key from dictionary.Initially the partitionby was not keeping same keys in same partition. But then I realized the keys were strings. I cast them to int. But the problem persisted. The numbers were very large. I then mapped these numbers to small numeric values and it worked. So my take away was that the keys need to be small integers.
I understand that partitionBy function partitions my data. If I use rdd.partitionBy(100) it will partition my data by key into 100 parts. i.e. data associated with similar keys will be grouped together

Is my understanding correct?
Is it advisable to have number of partitions equal to number of
    available cores? Does that make processing more efficient?
what if my data is not in key,value format. Can i still use this function?
lets say my data is serial_number_of_student,student_name. In this
        case can i partition my data by student_name instead of the
        serial_number?