unique

Display all matching values in one comma separated cell

北战南征 提交于 2021-02-18 15:42:10
问题 I have two columns of data in an Excel 2010 spreadsheet. In Column A is a category, and in Column B is a value. There will be multiple values in Column B for each unique category in Column A. What I want to achieve in a separate sheet is to display all of the values for each each unique category in one comma (or semi-colon etc) separated cell. For example, if my first sheet looks like this: ---------------------- | Category | Value | ---------------------- | Cat1 | Val A | | Cat1 | Val B | |

Get unique elements from a 2D list

你离开我真会死。 提交于 2021-02-17 06:32:18
问题 I have a 2D list which I create like so: Z1 = [[0 for x in range(3)] for y in range(4)] I then proceed to populate this list, such that Z1 looks like this: [[1, 2, 3], [4, 5, 6], [2, 3, 1], [2, 5, 1]] I need to extract the unique 1x3 elements of Z1 , without regard to order: Z2 = makeUnique(Z1) # The solution The contents of Z2 should look like this: [[4, 5, 6], [2, 5, 1]] As you can see, I consider [1, 2, 3] and [2, 3, 1] to be duplicates because I don't care about the order. Also note that

How to make a list in Python distinct based on a property of the class in the list?

一世执手 提交于 2021-02-16 16:07:18
问题 I have a list of instances from the same class, and I want to make my list distinct based on a property in the class. What is the most pythonic way to achieve this? Here is some sample code: #!/usr/bin/python #-*- coding:utf-8 -*- class MyClass(object): def __init__(self, classId, tag): self.classId = classId self.tag = tag myList = [] myInstance1 = MyClass(1, "ABC") myInstance2 = MyClass(2, "DEF") myInstance3 = MyClass(3, "DEF") myList.append(myInstance1) myList.append(myInstance3) # note

How to make a list in Python distinct based on a property of the class in the list?

一曲冷凌霜 提交于 2021-02-16 16:06:56
问题 I have a list of instances from the same class, and I want to make my list distinct based on a property in the class. What is the most pythonic way to achieve this? Here is some sample code: #!/usr/bin/python #-*- coding:utf-8 -*- class MyClass(object): def __init__(self, classId, tag): self.classId = classId self.tag = tag myList = [] myInstance1 = MyClass(1, "ABC") myInstance2 = MyClass(2, "DEF") myInstance3 = MyClass(3, "DEF") myList.append(myInstance1) myList.append(myInstance3) # note

Find uniqueness in data frame withe rows NA?

柔情痞子 提交于 2021-02-16 08:54:51
问题 I have a data frame like below. I would like to find unique rows (uniqueness). But in this data I have 'NA'. I like if all value in one row with NA value is the same with other rows (like rows: 1,2,5) I want to ignore it, but if not same (like rows : 2,4) I like to keep it as unique row. For example, in rows 1 ,2 and 6 all values except NA are the same so because NA can be value '1 and 3' I like to remove this row and just keep row 2. Also, in row 6 values 2 and 3 (exclude NA) are the same as

Excel Count unique value multiple columns

末鹿安然 提交于 2021-02-11 18:24:55
问题 I have a workbook with multiple sheets. On sheet1 I would like to count the number of times person in column A has a particular entry in Column C that meets criteria of column D = Content but only count if column B is a unique value. Using the below formula I can do everything except only counting unique numbers in Column B. I enter this formula in Sheet2 C2 then pull across to I2 then pull down to 6 in each column. =IF(COUNTIFS(Sheet1!$A$2:$A$150,Sheet2!$B2,Sheet1!$C$2:$C$150,Sheet2!C$1

Excel Count unique value multiple columns

心已入冬 提交于 2021-02-11 18:24:36
问题 I have a workbook with multiple sheets. On sheet1 I would like to count the number of times person in column A has a particular entry in Column C that meets criteria of column D = Content but only count if column B is a unique value. Using the below formula I can do everything except only counting unique numbers in Column B. I enter this formula in Sheet2 C2 then pull across to I2 then pull down to 6 in each column. =IF(COUNTIFS(Sheet1!$A$2:$A$150,Sheet2!$B2,Sheet1!$C$2:$C$150,Sheet2!C$1

Wordpress: How to make unique field with ACF and custom post type

牧云@^-^@ 提交于 2021-02-11 01:59:17
问题 So I'm working on a custom post type to work together with Advanced custom fields. And I have this little script that is supposed to block duplicate emails from being entered. But the script does not work as I want it to. The code that u see below is for the custom post type page that I've linked to ACF. function init_members() { $labels = array( 'name' => 'Members', 'singular_name' => 'Member', 'menu_name' => 'Members', 'name_admin_bar' => 'Member', 'add_new' => 'New member', 'add_new_item'

Wordpress: How to make unique field with ACF and custom post type

会有一股神秘感。 提交于 2021-02-11 01:57:54
问题 So I'm working on a custom post type to work together with Advanced custom fields. And I have this little script that is supposed to block duplicate emails from being entered. But the script does not work as I want it to. The code that u see below is for the custom post type page that I've linked to ACF. function init_members() { $labels = array( 'name' => 'Members', 'singular_name' => 'Member', 'menu_name' => 'Members', 'name_admin_bar' => 'Member', 'add_new' => 'New member', 'add_new_item'

How do I keep duplicates but remove unique values based on column in R

爱⌒轻易说出口 提交于 2021-02-07 20:05:22
问题 How can I keep my duplicates, but remove unique values based on one column(qol)? ID qol Sat A 7 6 A 7 5 B 3 3 B 3 4 B 1 7 C 2 7 c 1 2 But I need this: ID qol Sat A 7 6 A 7 5 B 3 3 B 3 4 What can I do? 回答1: dplyr solution: library(dplyr) ID <- c("A", "A", "B", "B", "B", "C", "c") qol <- c(7,7,3,3,1,2,1) Sat <- c(6,5,3,4,7,7,2) test_df <- data.frame(cbind(ID, qol, Sat)) filtered_df <- test_df %>% group_by(qol) %>% filter(n()>1) Please note that this will return ID qol Sat 1 A 7 6 2 A 7 5 3 B 3