I have the following structure:
data_Cnx = pd.read_csv(path_Connection,sep='\t',header=None)
data_Cnx.columns = ["ConnectionID"]
data_Srv = pd.read_csv(path_Service,sep='\t',header=None)
data_Srv.columns = ["ServiceID"]
that can be visualized as the following:
print(data_Cnx)
ConnectionID
0 CN0120
1 CN0121
2 CN0122
3 CN0123
4 CN0124
... ...
20 CN0166
21 CN0167
22 CN0168
23 CN0171
24 CN0172
[25 rows x 1 columns]
print(data_Srv)
ServiceID
0 ST030
1 ST030
2 ST030
3 ST030
4 ST030
... ...
20 ST040
21 ST040
22 ST040
23 ST050
24 ST050
[25 rows x 1 columns]
Literally, each element from data_Cnx
corresponds to a parallel element in data_Srv
, respecting the order. For instance:
CN0120 corresponds to ST030
CN0121 corresponds to ST030
....
CN0166 corresponds to ST040
CN0167 corresponds to ST040
...
CN0171 corresponds to ST050
...
I would like to have another structure or different data_Cnx
and data_Srv
in which the order of data_Cnx
can be randomized, but always in respect of what corresponds in data_Srv
. For instance:
The data_Cnx
and data_Srv
can be visualized as the following:
print(data_Cnx)
ConnectionID
0 CN0120
1 CN0168
2 CN0156
3 CN0133
4 CN0161
... ...
20 CN0121
21 CN0143
22 CN0127
23 CN0151
24 CN0132
print(data_Srv)
[25 rows x 1 columns] ServiceID
0 ST030
1 ST040
2 ST070
3 ST010
4 ST040
... ...
20 ST030
21 ST050
22 ST030
23 ST070
24 ST010
I was thinking of using randn, but obviously it uses integers as parameters. Do you have an easier idea of how can this be implemented?
Aucun commentaire:
Enregistrer un commentaire