The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [unique]

Refers to an element that is distinctly different from any other element in a collection.

0
votes
2answers
29 views

How to get the common values from 2 Laravel collections

I have 2 Collections in Laravel, and I want only common values in my $result object. I see that $collection->intersect() works only for 1D array. Below are the collections Collection {#1086 ▼ #...
1
vote
0answers
23 views

Combinations of a group into multiple groups without repetition

We have a list of elements [A,B,C,D,E] and 3 groups to combine those elements, I would like to print a list of all unique combinations without repetition for those 3 groups. Only groups of lengths [2,...
0
votes
3answers
34 views

How to create a list for all unique elements in a column that share the same ID in another column?

I have a dataset all_transcripts in which I have one column ConvID and a column name: >all_transcripts ConvID Name 5 Guest 5 Guest 5 Agent 5 Guest 5 ...
0
votes
0answers
28 views

SQL Query to create Match causing duplicates unable to avoid

I'm creating SQL Query to match from a staging table to a Dynamics GP Table. The query I've created works for 90% of what I need except for when the Item Number and Line # are the same. There are ...
0
votes
1answer
27 views

Assign A Value of 1 or 0 based on condition

I have monthly reports from October through April and have stacked all of the data. I sorted the data by UniqueID and then Date. I want to create a dummy variable that will meet the following ...
0
votes
2answers
40 views

How to count the number of unique strings in each element of a list

I have a list with a number of strings. I would like to count the number of unique strings in each element of the list. For example: My list called test looks like: test <- list( c("X", "Y", "Z"...
2
votes
1answer
40 views

nunique into new dataframe

I have some data in pandas: df1 df1['ID_A'].nunique() 5 df2 df2['ID_B'].nunique() 6 df3 df1['ID_A'].nunique() 2 df4 df2['ID_B'].nunique() 9 and so-on until 200 df. how to make new dataframe based ...
1
vote
6answers
51 views

Assign unique ID to each data.frame element in a list [duplicate]

I have a list of many (spatial) data.frames. I want to add a column to each data.frame that has an ID equivalent to the list index ID (i.e., every row in each individual data.frame's new column will ...
4
votes
3answers
65 views

BelongsToMany relation. How to get unique rows

I have next 'member_companies' table in DB: And in model Member has a relation : public function companies() { return $this->belongsToMany(Company::class, 'member_companies'); } And it ...
0
votes
2answers
27 views

Tables Are Not Linking. Returning ALL results?

on the file I have (link here: https://drive.google.com/open?id=1Cwdli7HG9npIUPg9V_y6v3Brro7vT_9A) I am really struggling trying to link both my tables by "Booking Ref". It's clearly the unique ...
1
vote
2answers
33 views

Delete duplicate words in array with sentences in PHP

I have a string array with words and sentences included. For example: array("dog","cat","the dog is running","some other text","some","text") And I want to remove duplicate words, leaving only ...
1
vote
2answers
52 views

How to split up an array by unique keys?

I am finding the lowest value in the array "value" using a min function. The lowest value is assigned a 1, all else 0. I have several descriptive column variables: drug, size, strength, form, time. ...
2
votes
3answers
51 views

How to remove subarrays with duplicated column value?

I have an array like this- Array ( [0] => Array ( [size] => 12" x 24" [size_description] => <p>Rectified</p> ) [1] => Array (...
0
votes
2answers
52 views

Set a variable to NA if other variables are duplicates in R

I have the following data frame containing medicine code according to the route of administration : code <- data.frame(inn = c("ibuprofen", "ibuprofen", "ibuprofen", "fusidic acid", "fusidic acid")...
0
votes
2answers
51 views

Is there a way I can exclude non repeating numbers in my array without creating another array?

I need to create an output that takes numbers from two arrays : a and b; and prints the unique ones out but only once. so for example if had int[] a = { 4,3,4,3,6,7,4,8,2,9 }; int[] b = { 2,3,6,8,1,...
1
vote
1answer
20 views

Ensuring unique values in dplyr::summarise() in most efficient way

I usually have a tibble with lots of columns of type character (between 20 and 30) and only 3-4 columns of type numeric. Grouping and summarizing the numeric columns is super fast, but my approach ...
1
vote
1answer
28 views

Numpy way to check if any two samples in a tensor are identical

Some examples: import numpy as np tensor_same = np.array([[1]*10 + [2] * 10 + [1] * 10]).reshape((-1, 10, 1)) tensor_diff = np.array([[1]*10 + [2] * 10 + [1] * 9 + [2]]).reshape((-1, 10, 1)) The ...
2
votes
2answers
66 views

Why is the “uniqueness: true” validation not working in my test (Rails)?

In my Rails app, I am trying to save MAC addresses for devices belonging to different users. Each MAC address must be unique, so I included the uniqueness validation. The validation itself seems to be ...
0
votes
5answers
49 views

How do I create a unique file name for my image uploader?

I have a form that has the option to upload images. All is working fine, however, I need to makes those images uploaded have a unique name or number before/after original file name as to not ...
-1
votes
1answer
24 views

How to modify the value of a unique index

CREATE TABLE `entityfeedhot` ( `efhid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID', `idx` int(10) unsigned NOT NULL COMMENT 'order num', `age` int(10) unsigned NOT NULL COMMENT '', ...
0
votes
0answers
16 views

how to validate a string and a mongo object id object using unique combined validation in yii2

I am trying to validate two fields (they should be unique together ) in yii2 . One is a string value and one is a mongodb objectid object (i.e project_id) . However the validation is not working I ...
0
votes
0answers
14 views

Does Firebase dynamic links builder always generate unique links?

I'm just curious, if I use the Dynamic Links iOS (or Android) Builder API. Is there still an ever so slighty, tiny tiny chance, that two devices would generate the same short URL, yet want to use it ...
0
votes
1answer
59 views

R Help: Count Unique Values by Group [duplicate]

Here is a sample dataset to illustrate my problem: example=data.frame(Group1=c(1,1,1,2,2,10,15,23), Group2=c(100,100,150,200,234,456,465,710), UniqueID=c('ABC67DF','...
1
vote
1answer
69 views

Select rows of ids that have a pattern without losing the other rows

I have the following data frame: # Example: _________________________ | id | day | state ------------------------- [1,] 1 0 0 [2,] 1 1 0 [3,] 1 2 0 [4,] 1 ...
2
votes
2answers
38 views

MySQL insert new value when no other like that

I am trying to solve the problem with insert new value into table. Primary key is ID not email... Before insert i need check other records for email value. If no one match inserted email, data is ...
0
votes
2answers
25 views

Compare `n` plaintext files and print number of unique lines per file

I have n number of plaintext files with lines of text in them. Some lines are duplicated between some of the files. Is there a method in bash where I can compare the files and print out how many ...
1
vote
1answer
40 views

Does Windows have a unique key/fingerprint, that won't go away after reinstallation?

I have a question that I couldn't find an answer online, so I decided to ask here. Does Windows have a "Unique Identifier" per PC? That's not the CD-Key? If so: 1a. Is it possible to get and use ...
0
votes
0answers
22 views

Is there an R function for a complex unique values in R? [duplicate]

I am organizing my dataset, and I want a unique value for it. I have three column in my dataset, for example. My input.txt is designed as: Var1 Var2 ACC A B 0.10 B A 0.10 A C 0....
2
votes
3answers
47 views

Take unique records from text file using LINQ

I have set up ICollection<User> list: public ICollection<User> MyUsers { get; set; } public IList<User> GetUserList(string path) { MyUsers = File.ReadAllLines(path) ...
0
votes
3answers
42 views

Don't return duplicate title in WordPress loop

I have this standard loop for returning titles of a custom post type: <ul> <?php $args = array( 'post_type' => 'food_types', 'posts_per_page' =&...
1
vote
1answer
87 views

Merge 3 columns based on unique values?

I am trying to do a merge on 3 columns to a single one. The column values are separated by ";" and the new column need to unzip all the 3 column values and put the unique values. I know how to perform ...
0
votes
1answer
40 views

Django framework form is trying to insert a new record instead of updating

Django 1.11.4 python 3.6 I have a default Django framework form I use for both update and create records for a given model. The primary key ("id" field) is generated by Django. The rest is defined ...
2
votes
1answer
24 views

how to make many columns unique in same table

ALTER TABLE `registered` CHANGE `Email_ID` UNIQUE KEY ( Email_ID) ) ; #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right ...
-4
votes
2answers
95 views

How to filter from an array in ios swift

I have an array in which I append the values coming from JSON. like this var tagsarray = [Tagging]() tagsarray.append(Tagging.init(tags: tempTag[0], selected: false)) tagsarray.append(Tagging....
1
vote
3answers
109 views

C++ How to generate 10,000 UNIQUE random integers to store in a BST?

I am trying to generate 10,000 unique random integers in the range of 1 to 20,000 to store in a BST, but not sure the best way to do this. I saw some good suggestions on how to do it with an array ...
2
votes
1answer
65 views

How do you count consecutive strings in file using powershell?

So I want to know how I could get content from a file and count the consecutive occurrences of a string within that file? So my file has the following strings: 1 1 1 0 0 0 0 1 1 1 0 1 1 0 0 0 1 0 1 1 ...
0
votes
0answers
26 views

Calculate average of: max based on unique value in another column Excel pivot and PowerBI

I've built a process which results in a table on SQL Server with data as seen in the image below which is then connected to Excel/PowerBI for reporting. Dept Lvl 1 is the highest in the hierarchy and ...
0
votes
2answers
44 views

Validation for three unique fields and soft deletes

Last year I made a laravel site with an events table where I needed three fields to be unique for any event (place, date and time). I wasn't able to set up a validation request to do this so I added ...
0
votes
1answer
12 views

Filter data frame by combination of 2 variables that appear in other data frame

Suppose i have two data frames, DF1 and DF2 DF1: CustomerID Name PurchaseCode 1 Drue 1234 2 David 1222 3 Chris 1333 5 ...
0
votes
0answers
43 views

Working Example of VBA password protect PDF with Unique Passwords

Good Day Stackers, Ok, I would like to preface this question by first noting we are in the year 2019, and I have found numerous no-longer-valid solutions from 2002-2012 but NOTHING as within the last ...
0
votes
0answers
24 views

NestJs Tyeporm - Why does a Unique constraint in an entity throw an exception and crash the app

I have an entity described as export class TeamEntity { @PrimaryGeneratedColumn('uuid') readonly id: string; @CreateDateColumn() readonly createdAt: Date; @UpdateDateColumn() updatedAt: ...
0
votes
1answer
37 views

Whats is the best workaround to inherit unique contraints in Postgres?

In Postgres I am trying to inherit an unique attribute from a parent to its children. The parent table is an abstract table, with no entries in it. The names of all children should be unique. ...
1
vote
1answer
33 views

pandas inclusive unique values from two columns

I can't find any elegant way to select unique rows from column A and column B but not jointly and not in a sequence. This is in order to keep "inclusive" intersection of unique values from these two ...
0
votes
0answers
48 views

How to generate a stable Primary Key

I store a list of names in the database. The list does not have any primary key for each record. These names are then used by another program and so require a primary key to be used as a foreign key. ...
0
votes
2answers
36 views

Getting counts based on status of the record rails

I have a scenario where I have to show the count of the total enrolled people for a process. There are two statuses inprogress and completed. The person can enroll the process multiple times and for ...
0
votes
2answers
38 views

Make paste command by unique id-s

I have a network analysis to do, but i am stuck with it. I have numerous (26 000+) project id-s, with various number of participants (ranging from 1 to 193 by projects). For the network analysis i ...
-1
votes
1answer
27 views

Remove duplicates from csv (ie remove original and the duplicate)

Scenario: I have two csv files. One CSV is a trusted address file (trusted.csv), the other csv is testing address file (testing.csv) that will have duplicates addresses from the first file. The ...
0
votes
2answers
98 views

getting unique records on the basis of specific associated column - rails active record associations

I have three models. User, Question and Attempt. Each User has_many :attempts, similarly, Question has_many :attempts and Attempt belongs_to User and Question Required: What I want is a method ...
0
votes
0answers
30 views

SQLITE only unique correlation

I would like to know, if there is a way to add only events to my SQLite Database when there is a unique correlation between two columns. I only want unique Connection-Events added. Example between ...
1
vote
3answers
44 views

Pandas: combining duplicate index values

I have a pandas series that I would like to combine in three different ways. The series is as follows: import pandas as pd timestamps = [1,1,1,2,3,3,3,4] quantities = [10,0,2,6,7,2,8,0] series = pd....