indexing

Indexing 3d numpy array with 2d array

别说谁变了你拦得住时间么 提交于 2021-02-09 06:52:08
问题 I would like to create a numpy 2d-array based on values in a numpy 3d-array, using another numpy 2d-array to determine which element to use in axis 3. import numpy as np #-------------------------------------------------------------------- arr_3d = np.arange(2*3*4).reshape(2,3,4) print('arr_3d shape=', arr_3d.shape, '\n', arr_3d) arr_2d = np.array(([3,2,0], [2,3,2])) print('\n', 'arr_2d shape=', arr_2d.shape, '\n', arr_2d) res_2d = arr_3d[:, :, 2] print('\n','res_2d example using element 2 of

Indexing 3d numpy array with 2d array

三世轮回 提交于 2021-02-09 06:49:53
问题 I would like to create a numpy 2d-array based on values in a numpy 3d-array, using another numpy 2d-array to determine which element to use in axis 3. import numpy as np #-------------------------------------------------------------------- arr_3d = np.arange(2*3*4).reshape(2,3,4) print('arr_3d shape=', arr_3d.shape, '\n', arr_3d) arr_2d = np.array(([3,2,0], [2,3,2])) print('\n', 'arr_2d shape=', arr_2d.shape, '\n', arr_2d) res_2d = arr_3d[:, :, 2] print('\n','res_2d example using element 2 of

Indexing 3d numpy array with 2d array

谁说我不能喝 提交于 2021-02-09 06:49:37
问题 I would like to create a numpy 2d-array based on values in a numpy 3d-array, using another numpy 2d-array to determine which element to use in axis 3. import numpy as np #-------------------------------------------------------------------- arr_3d = np.arange(2*3*4).reshape(2,3,4) print('arr_3d shape=', arr_3d.shape, '\n', arr_3d) arr_2d = np.array(([3,2,0], [2,3,2])) print('\n', 'arr_2d shape=', arr_2d.shape, '\n', arr_2d) res_2d = arr_3d[:, :, 2] print('\n','res_2d example using element 2 of

Indexing 3d numpy array with 2d array

假如想象 提交于 2021-02-09 06:49:15
问题 I would like to create a numpy 2d-array based on values in a numpy 3d-array, using another numpy 2d-array to determine which element to use in axis 3. import numpy as np #-------------------------------------------------------------------- arr_3d = np.arange(2*3*4).reshape(2,3,4) print('arr_3d shape=', arr_3d.shape, '\n', arr_3d) arr_2d = np.array(([3,2,0], [2,3,2])) print('\n', 'arr_2d shape=', arr_2d.shape, '\n', arr_2d) res_2d = arr_3d[:, :, 2] print('\n','res_2d example using element 2 of

SQL Server why is index not used with OR

淺唱寂寞╮ 提交于 2021-02-08 15:11:54
问题 I've been studying indexes and trying to understand how they work and how I can use them to boost performance, but I'm missing something. I have the following table: Person : | Id | Name | Email | Phone | | 1 | John | E1 | P1 | | 2 | Max | E2 | P2 | I'm trying to find the best way to index the columns Email and Phone considering that the queries will (most of the time) be of the form [1] SELECT * FROM Person WHERE Email = '...' OR Phone = '...' [2] SELECT * FROM Person WHERE Email = ... [3]

Add additional attributes to an existing document elasticsearch

廉价感情. 提交于 2021-02-08 12:33:30
问题 How do I add additional attributes to an existing document in Elasticsearch index. $ curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{ "user" : "kimchy", "post_date" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search" }' This would create a document in the index. How do I add an attribute to the document? Suppose "new_attribute":"new_value" which would modify the document as "user" : "kimchy", "post_date" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search"

Add additional attributes to an existing document elasticsearch

徘徊边缘 提交于 2021-02-08 12:32:07
问题 How do I add additional attributes to an existing document in Elasticsearch index. $ curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{ "user" : "kimchy", "post_date" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search" }' This would create a document in the index. How do I add an attribute to the document? Suppose "new_attribute":"new_value" which would modify the document as "user" : "kimchy", "post_date" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search"

Index Bounds on Mongo Regex Search

陌路散爱 提交于 2021-02-08 12:20:25
问题 I'm using MongoDB, and I have a collection of documents with the following structure: { fName:"Foo", lName:"Barius", email:"fbarius@example.com", search:"foo barius" } I am building a function that will perform a regular expression search on the search field. To optimize performance, I have indexed this collection on the search field. However, things are still a bit slow. So I ran an explain() on a sample query: db.Collection.find({search:/bar/}).explain(); Looking under the winning plan, I

Index Match using VBA Function in Microsoft Excel

China☆狼群 提交于 2021-02-08 11:31:56
问题 I'm new to Excel VBA and am trying to write a function that lets me use INDEX , MATCH and COUNTIFS functions to find value for a given column by matching criteria in other columns (multiple). I have a table named Price which contains some prices offered in different locations based on an assigned category: Area Category Cost Retail Price Wholesale Price USA Bad 1 13 25 Canada Okay 2 14 26 Mexico Good 3 15 27 USA Excellent 4 16 28 Canada Bad 5 17 29 Mexico Okay 6 18 30 USA Good 7 19 31 Canada

Lucene LongPoint Range search doesn't work

我的梦境 提交于 2021-02-08 10:12:48
问题 I am using Lucene 8.2.0 in Java 11. I am trying to index a Long value so that I can filter by it using a range query, for example like so: +my_range_field:[1 TO 200] . However, any variant of that, even my_range_field:[* TO *] , returns 0 results in this minimal example. As soon as I remove the + from it to make it an OR , I get 2 results. So I am thinking I must make a mistake in how I index it, but I can't make out what it might be. From the LongPoint JavaDoc: An indexed long field for fast