I have csv with 2 columns: "Context", "Utterance".
I need to shuffle (make random order) "Context" column values. Note, that not full row to shuffle, but only 1 column, second column "Utterance" order remains the same.
For this i used: answers (shuffling/permutating a DataFrame in pandas)
train_df2 = pd.read_csv("./data/nolabel.csv", encoding='utf-8', sep=",")
train_df2.drop('Utterance', axis=1, inplace=True) # delete 'Utterance'
train_df2 = train_df2.sample(frac=1) # shuffle
train_df2['Utterance'] = train_moscow_df['Utterance'] # add back 'Utterance'
train_df2["Label"] = 0
header = ["Context", "Utterance", "Label"] #
train_df2.to_csv('./data/label0.csv', columns = header, encoding='utf-8', index = False)
BUT, result is bad: i got a full rows shuffle, but corresponding values from 2 columns still the same.
I need that 1st value from 1st column correspond to random value from 2nd. (Also tried from sklearn.utils import shuffle
but no luck too)