The following seems to work:
import pandas as pd
import sklearn
df = sklearn.datasets.load_iris()
df = pd.DataFrame(df.data, columns=df.feature_names)
df.shuffle()
However this shuffle function seems not to be a documented DataFrame function?
Is this an internal function we are not supposed to use?
import janitorto it – and it would still be true that in the official Pandas doc, the now-availabledf.shuffle()method could not be found. All in all, I believe the question and its answers still have merit for a wider audience, but I guess it is a bit of an edge case.