2,315 questions
2 votes
2 answers
101 views
Undocumented pandas DataFrame shuffle() [closed]
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 ...
0 votes
0 answers
118 views
AVX2 cross-lane shuffles
I'm writing some AVX2 code that is very permutation-heavy. The main permutation instructions used are unpacks, VPSHUFB, some uses of VPERM2I128 and a few of VPBLENDW. After puzzling over the ...
2 votes
1 answer
84 views
Shuffle a dataset w.r.t a column value
I have the following Dataframe, which contains, among others, UserID and rank_group as attribute: UserID Col2 Col3 rank_group 0 1 2 3 1 1 1 5 6 1 ... 20 1 8 ...
0 votes
3 answers
170 views
Fastest way to randomly shuffle an array based on probabilities in PHP? [closed]
I have an array with values and probabilities (or in PHP, keys and values): Value Probability John 3 Peter 2 Paul 1 I want to shuffle this array but have the order be influenced by the ...
0 votes
0 answers
38 views
How can I shuffle grid elements without ruining the layout?
As you can see in the example I have 6 elements "other-news" (colored Fuchsia) on the right side of the grid stacked in 3x2 format. I want to be able to bring them to the left side and keep ...
3 votes
2 answers
102 views
Is there an algorithm for shuffling objects in an array randomly WITHOUT utilizing Lists and Collections
I want to shuffle an array of Objects in a card game simulation. I scrolled through many posts on here and almost all of them mention transforming the array into a list, then shuffling it using an ...
1 vote
1 answer
80 views
JavaScript shuffle elements but track original index or use modulus to insert them into parent markup
I have the following markup: <div class=""> <div class="tiled-gallery__gallery"> <div class="tiled-gallery__row columns-1"> <div class=&...
0 votes
0 answers
36 views
OOM issue on partition shuffling
Given Spark jobs are running on Kubernetes cluster executor pod has 4 cores there is java process with the params (-Xms3072m, -Xmx3072m) running in executor pod there is ORC file in AWS S3 of ~5MB ...
1 vote
1 answer
505 views
Does __shfl_sync in CUDA always operate on registers, or does it involve shared memory or global memory in some certain situations?
This question is inspired by the discussion in this link: When is shfl.sync.idx fast?, where it was debated whether __shfl_sync() and other warp-level shuffle instructions operate directly on the ...
2 votes
1 answer
89 views
How can I shuffle time blocks in time series without overlap in R?
Let's assume there is a group of 3 persons, for which I have a time series of when they start and finish an activity. An example dataframe would be: library(tidyverse) GrXX <- tibble(Individual = ...
0 votes
1 answer
69 views
How do I shuffle a specific 2D cell along the z-axis in a numpy 3D matrix?
Let's say I have a 3D numpy matrix M with shape (c, b, a). I want to shuffle a specific cell (x, y) in M along the z-axis --- that is, I want to shuffle the array [M[z][y][x] for z in range(c)] and ...
-4 votes
1 answer
62 views
python random.shuffle from lists in a text file
Trying to do a random.shuffle which works well if the list is declared. In example 2, I'm trying to do this from a file that has 1000 entries with the first two lines shown. Is the txt file formatted ...
0 votes
1 answer
79 views
What is the time complexity of sample?
Using the default arguments, what is the time complexity of sample? I.e. how does the running time of sample(1:N) grow with N? Documentation for sample is here but does not specify time complexity.
0 votes
3 answers
136 views
Pulling a shuffled list index returns the value of the original index
I'm attempting a silly little "random" number generator to try to get to grips with how lists and pulling values from them works in python. I have a variable defined as x, and I ask the code ...
0 votes
2 answers
61 views
Why is numpy shuffle not working in a loop?
Thanks very much in advance. I have a numpy array called X_test X_test.shape (11829, 16, 9) I am trying to shuffle the 2nd column of each element of the array with the code below. However, X_test_s ...