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 ...
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
0
answers
35
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 ...
1
vote
1
answer
72
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=&...
1
vote
1
answer
484
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 ...
0
votes
1
answer
63
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 ...
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
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 ...
0
votes
2
answers
178
views
Adding random images one by one on app in flutter
I am having trouble adding random images to the page by using a floating action button. After drawing an image from the .shuffle list, I want to draw another picture from the list. I could add more ...
0
votes
0
answers
2k
views
ELK and Wazuh as SIEM
I've been working on a SOC project, and part of my task is to design a technical architecture using open-source tools. During my research, I stumbled upon a highly useful architecture proposed, ...
-1
votes
1
answer
278
views
Spark Sort Operation in Join Despite Pre-sorted Bucketed Tables
I'm working with Spark and encountering an unexpected sort operation during a join of two pre-sorted and bucketed tables. Both tables have been created with the same number of buckets and are sorted ...
0
votes
0
answers
69
views
Is there an algorithm for thoroughly shuffling big datasets in-place with limited memory?
I have a large HDF5 file containing a single table. The table itself contains collections of ordered data that themselves are quite large but are stored contiguously in blocks. I need to shuffle the ...
-1
votes
1
answer
42
views
Python: Shuffle not working in class initialiser
I want to write a class "SomeClass" that stores a shuffled version of the list it is initialised with. However, the list is shuffled in exactly the same way for every instance of my class. ...
-1
votes
1
answer
176
views
Fisher-Yates shuffle: Who is right, .NET 8 or Wikipedia?
Was looking for shuffling an array from within Unity, remembered that .NET 8 has Random.Shuffle.
It turns out that the implementation is the Fisher-Yates algorithm.
But when looking at it and at ...
2
votes
1
answer
211
views
Pandas shuffle rows within groups in dataframe, leaving the relative groups order intact
Given the following df:
data = {'Org': ['Tom', 'Kelly', 'Rick', 'Dave','Sara','Liz'],
'sum': [3, 4, 4, 4, 5, 5]}
df = pd.DataFrame(data)
# Org sum
# 0 Tom 3
# 1 Kelly 4
# 2 ...
1
vote
0
answers
55
views
Why Spark is using both NettyBlockTransferService and my BlockStoreClient?
When running Spark App I've noticed that fetchBlocks function of both NettyBlockTransferService and my custom ShuffleClient (implementing BlockStoreClient) are being called.
I know what my ...
1
vote
1
answer
84
views
Pool two vectors together
I have two arrays like below: A from 1 to 4 repeated 8 times, B from 1 to 8 repeated 4 times. I want to shuffle B but with one correlation condition on the final Matrix. I don't want the same B value (...
3
votes
2
answers
151
views
Random shuffled value generator?
Is there an algorithm that can be used as pseudo random value generator as if the sequence was produced by shuffling ? By that I mean that in a set of k values and k generator calls each value is ...
0
votes
1
answer
441
views
Shuffling items in array when user click over them - React JS
Newbie here;
I have a <QuizPage /> component with a child component called <TriviaObject /> which holds three properties; a question, a correct answer with a string value, and an array of ...
0
votes
1
answer
149
views
SwiftUI: Shuffling answers in multiple choice quiz only when loading a new question
I want to shuffle answer options from Trivia API only when loading a new question, not every time a user selects an answer. Currently, the answers shuffle each time a user makes a selection.
For ...
2
votes
1
answer
190
views
Write a function to shuffle a given list. Make sure that all permutations are equally probable
Whilst reading Programming in Lua book, I came across an exercise which I'm not sure if I solved right, hence I wanted to ask you all.
Problem statement:
Exercise 6.4: Write a function to shuffle a ...
0
votes
0
answers
106
views
Schuffle.js Filtering with radio buttons and checkboxes
I am currently in the process of developing a module that involves a product archive. I've chosen to implement shuffle.js for this purpose, but I've encountered some issues along the way.
My objective ...
0
votes
2
answers
149
views
What is an algorithm for weighted shuffling that scales well? [closed]
Setup
Items in a set have a weight property that can be set by an admin user. Items with more weight are more likely to achieve top position in a randomized list served to public visitors. Every item ...
5
votes
1
answer
197
views
A shuffling algorithm that limits the number of consecutive repetitions?
I want a string shuffling algorithm that takes the following arguments:
void CRLimitedShuffle(char* Str, uint8_t MaxConsecutiveRepetition);
The function should perform a random shuffle on the input ...
-1
votes
1
answer
429
views
How can I shuffle data in csv file?
I have the following dataFrame
The data is from csv file and I would like to shuffle in each rows
this is my code that I imported csv file
df = pd.read_csv('data1.csv',header=None, names=cols)
...