import numpy as np
X = ([1,2,3], [2,4,5], [5,6,7])
y = ([2], [4], [5])
dist= np.random.RandomState(1)
r = dist.permutation(len(y))
让我们说
r= array([0, 2, 1])
是否有办法置换X和y的元素,以便根据r数组中的索引重新排序X和y元素,即y变为([2], [5], [1])
,X变为([1,2,3], [5,6,7], [2,4,5])
?我没有在python doc中找到答案。感谢
答案 0 :(得分:0)
您可以使用clear
:
vc1
修改强>
当vc2
发生这种情况时:
function uploadFile(){
data = {};
data['file']= document.getElementById('fileToUpload').files[0];
$.ajax({
url:'/admin/conference/presentation/changes/file',
data: data,
type: 'POST',
contentType: false,
processData: false,
success: function(data){
console.log(data);
}
});}
然后你使用 $config['upload_path'] = FCPATH.'./';
$config['allowed_tyeps'] = '*';
$this->load->library('upload', $config);
if(!$this->upload->do_upload()){
$upload_error = $this->upload->display_errors();
echo $upload_error;
}
这种情况:
zip
当你只从[i for _, i in sorted(zip(r, X])]
ed和zip
中取出第二个元素时,你会得到这个:
zip(r, X)
#((0, [1,2,3]), (2, [2,4,5]), (1, [5,6,7]))