“Shuffle DataFrame Python” Código de respuesta

Shuffle DataFrame Python

df = df.sample(frac=1).reset_index(drop=True)
Cook's Tree Boa

Shuffle de filas DataFrame

df = df.sample(frac=1).reset_index(drop=True) #Use if you want to reset index order

df.sample(frac=1) # Use for no reset in index order
Careful Coyote

marcar al azar Pandas DataFrame

  shuffled_train_df = train_df.reindex(np.random.permutation(train_df.index))
Important Iguana

Respuestas similares a “Shuffle DataFrame Python”

Preguntas similares a “Shuffle DataFrame Python”

Más respuestas relacionadas con “Shuffle DataFrame Python” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código