# Randomly splits this DataFrame with the provided weights splits = df4.randomSplit([1.0, 2.0], 24) splits[0].count() # 1 splits[1].count() # 3