unique

Listing all possible combination without repetition,VBA

泪湿孤枕 提交于 2020-07-22 04:35:49
问题 I have a code that work right now and lists numbers at 6 lenght.But they are repetive.But these numbers are repeated.I need unique non-repeated 6 digit. I have this kind of results right now.1 1 1 3 4 6 but i need different and non repeating results.Thank you for helping me. Sub AllCombinations() Dim nums(): nums = Array(1, 2, 3, 4, 5, 6, 7, 8, 9) Dim arValues(999999, 5) Dim n1 As Integer, n2 As Integer, n3 As Integer, n4 As Integer, n5 As Integer, n6 As Integer, x As Long For n1 = 0 To

Python pandas unique value ignoring NaN

爱⌒轻易说出口 提交于 2020-07-17 07:45:06
问题 I want to use unique in groupby aggregation, but I don't want nan in the unique result. An example dataframe: df = pd.DataFrame({'a': [1, 2, 1, 1, pd.np.nan, 3, 3], 'b': [0,0,1,1,1,1,1], 'c': ['foo', pd.np.nan, 'bar', 'foo', 'baz', 'foo', 'bar']}) a b c 0 1.0000 0 foo 1 2.0000 0 NaN 2 1.0000 1 bar 3 1.0000 1 foo 4 nan 1 baz 5 3.0000 1 foo 6 3.0000 1 bar And the groupby : df.groupby('b').agg({'a': ['min', 'max', 'unique'], 'c': ['first', 'last', 'unique']}) It's result is: a c min max unique

Pandas: make pivot table with percentage

你离开我真会死。 提交于 2020-07-14 05:11:38
问题 I have dataframe ID,url,used_at,active_seconds,domain 61a77f9e5fd52a50c10cd2d4d886ec68,mazdaspb.ru,2015-01,6,mazdaspb.ru 61a77f9e5fd52a50c10cd2d4d886ec68,mazdaspb.ru/cars/mazda-cx-5/crossover/overview,2015-01,12,mazdaspb.ru 61a77f9e5fd52a50c10cd2d4d886ec68,mazdaspb.ru/cars/mazda-cx-5/crossover/overview,2015-01,19,mazdaspb.ru 61a77f9e5fd52a50c10cd2d4d886ec68,vw-stat.ru,2015-01,40,vw-stat.ru 61a77f9e5fd52a50c10cd2d4d886ec68,vw-stat.ru/models/new_tiguan,2015-01,12,vw-stat.ru

Determine if there are duplicates in vector

时光怂恿深爱的人放手 提交于 2020-07-09 13:47:09
问题 I would like to determine if there are duplicates in a vector. What is the best option here? sort(arrLinkToClients.begin(), arrLinkToClients.end(), [&](const type1& lhs,const type1& rhs) { lhs.nTypeOfLink < rhs.nTypeOfLink; }); auto it = unique(arrLinkToClients.begin(), arrLinkToClients.end(), [&](const type1& lhs, const type1& rhs) { lhs.nTypeOfLink == rhs.nTypeOfLink; }); //how to check the iterator if there are duplicates ? if (it) { // } 回答1: The "best" option does not exist. It depends

Get unique value of one attribute from array of associative arrays

非 Y 不嫁゛ 提交于 2020-07-08 07:24:49
问题 I have an array like this: $a = array( 0 => array('type' => 'bar', 'image' => 'a.jpg'), 1 => array('type' => 'food', 'image' => 'b.jpg'), 2 => array('type' => 'bar', 'image' => 'c.jpg'), 3 => array('type' => 'default', 'image' => 'd.jpg'), 4 => array('type' => 'food', 'image' => 'e.jpg'), 5 => array('type' => 'food', 'image' => 'f.jpg'), 6 => array('type' => 'food', 'image' => 'h.jpg') ) How do I figure out unique type values (which would be food, bar and default)? I could iterate through the

Get unique value of one attribute from array of associative arrays

不打扰是莪最后的温柔 提交于 2020-07-08 07:23:26
问题 I have an array like this: $a = array( 0 => array('type' => 'bar', 'image' => 'a.jpg'), 1 => array('type' => 'food', 'image' => 'b.jpg'), 2 => array('type' => 'bar', 'image' => 'c.jpg'), 3 => array('type' => 'default', 'image' => 'd.jpg'), 4 => array('type' => 'food', 'image' => 'e.jpg'), 5 => array('type' => 'food', 'image' => 'f.jpg'), 6 => array('type' => 'food', 'image' => 'h.jpg') ) How do I figure out unique type values (which would be food, bar and default)? I could iterate through the

Finding a more efficient way of using SUM PRODUCT and COUNTIF

爷,独闯天下 提交于 2020-07-07 11:56:52
问题 I currently have this formula which works but it takes a few seconds for excel to catch up, and I was wondering if anyone knew about a more efficient way of handling this. Aside for it taking a few seconds to process when I drag the formula down excel doesn't update the new cells and eventually crashes the entire file. =SUMPRODUCT(((Paste!$B$2:$B$12000=A2))/COUNTIFS(Paste!$B$2:$B$12000,Paste!$B$2:$B$12000&"",Paste!$C$2:$C$12000,Paste!$C$2:$C$12000&"")) Sample Data: 回答1: Let's imagine the data

Finding a more efficient way of using SUM PRODUCT and COUNTIF

若如初见. 提交于 2020-07-07 11:55:28
问题 I currently have this formula which works but it takes a few seconds for excel to catch up, and I was wondering if anyone knew about a more efficient way of handling this. Aside for it taking a few seconds to process when I drag the formula down excel doesn't update the new cells and eventually crashes the entire file. =SUMPRODUCT(((Paste!$B$2:$B$12000=A2))/COUNTIFS(Paste!$B$2:$B$12000,Paste!$B$2:$B$12000&"",Paste!$C$2:$C$12000,Paste!$C$2:$C$12000&"")) Sample Data: 回答1: Let's imagine the data

adding timestamp while uploading image file is not working

天涯浪子 提交于 2020-06-29 03:41:55
问题 I am developing a ad site that anyone able to upload 3 images. So I am coding to upload that 3 images by adding timestamp in front of their file name to make them unique. I use codeigniter framework and attaching the code below. when I submitting form data, localhost server shows that images have been saved correctly with some code infornt of image filename. But problem is there are no images saved in relevant image folder in that name and I cannot retrieve that images in next preview

Find unique pairs of values in Tensorflow

孤街醉人 提交于 2020-06-28 05:28:22
问题 In Python 3.X + TensorFlow, if I have two TF vectors, point_x and point_y (same shape) that represent the X and Y coordinates of some number of pointers, how do I find all unique points? I was able to hack this together in Theano using a complex vector, with X in the real and Y in the imaginary portion: complex_points = point_x + point_y * 1j unique_points, idxs, groups = T.extra_ops.Unique(True, True, False)(complex_points) The TF equivalent I'm trying is: complex_points = tf.complex(point_x