def partitioning_index(df, npartitions):
 return (hash_pandas_object(df, index=False) % int(npartitions))

def partitioning_index ( df , npartitions ) : return ( hash_pandas_object ( df , index = False ) % int ( npartitions ) )
computes a deterministic index mapping each record to a partition .