How to get results without duplicates ? I have a CSV file shown in the description below, I take all the columns together, to get a random result from all the columns together, but I get results with duplicates.
Thank you
test.csv
d c b a
-----------------
0 Q A A Q
1 K A K 8
2 8 10 8 10
import pandas as pd
import numpy as np
df = pd.read_csv('test.csv', usecols=['a','b','c','d'])
df = np.array(df.iloc[0:3])
np.random.seed(2)
print(np.random.choice(df.flatten(), size=(20, 2)))
results
[['8' '8'] # duplicate
['K' '10']
['A' '10']
['8' '8'] # duplicate
['A' 'A']
['10' 'A'] # duplicate
['8' 'K'] # duplicate
['K' 'A']
['8' 'Q']
['K' 'K']
['8' '10']
['Q' '8']
['K' '8']
['A' '8']
['Q' 'A']
['8' 'K'] # duplicate
['K' 'Q']
['10' 'A'] # duplicate
['Q' 'K']
['A' 'K']]