来自此数组:
var arr = [
{
element: 'anything',
order: 1
},
{
element: 'something',
order: 2
}
]
我想生成这个:
arr = ['anything', 'something'];
该怎么做?
答案 0 :(得分:4)
使用地图功能
1 m = np.mean(df1.open)
2 s = np.std(df1.open)
3 df1 = df1[df1['open'] <= m + 2*s]
4 df1 = df1[df1['open'] >= m - 2*s]
5 df1.shape
E:\Anaconda-Installed\lib\site-packages\pandas\core\generic.py in
__getattr__(self, name)
3079 if name in self._info_axis:
3080 return self[name]
3081 return object.__getattribute__(self, name)
3082
3083 def __setattr__(self, name, value):
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
答案 1 :(得分:1)
您可以使用
之类的东西var newArr = [];
$.each(arr, function(index, value) {
newArr.push(value);
});
答案 2 :(得分:1)
您可以使用香草js :,如@James L.所示:
arr.map(x => x.element);
或使用jQuery Map函数:
$.map(arr, function(val, i){
return val.element;
})
查看文档:{{3}}