any

What is exactly “SOME / ANY” and “IN”

心已入冬 提交于 2021-02-08 11:10:38
问题 When someone is calling a function by "SOME" or "ANY" makes me unsure about this. Can I think about "SOME" as "OneOf" or "OneFrom"? Like an array (table) searching function? If yes, then what's the difference between SOME and IN? I am total newbie with SQL Sorry for my bad english, for some reason I think I am little overtired to use it correctly now 回答1: Check the following link for some examples that should clarify the difference between them: http://technet.microsoft.com/en-us/library

R: Generate a dummy variable based on the existence of one column' value in another column

扶醉桌前 提交于 2021-02-08 03:39:36
问题 I have a data frame like this: A B 2012,2013,2014 2011 2012,2013,2014 2012 2012,2013,2014 2013 2012,2013,2014 2014 2012,2013,2014 2015 I wanted to create a dummy variable, which indicates whether the value in column B exists in column A. 1 indicates the existence, and 0 indicates non-existant. Such that, A B dummy 2012,2013,2014 2011 0 2012,2013,2014 2012 1 2012,2013,2014 2013 1 2012,2013,2014 2014 1 2012,2013,2014 2015 0 I have tried to use %in% to achieve this: df$dummy <- ifelse(df$B %in%

R: Generate a dummy variable based on the existence of one column' value in another column

◇◆丶佛笑我妖孽 提交于 2021-02-08 03:37:16
问题 I have a data frame like this: A B 2012,2013,2014 2011 2012,2013,2014 2012 2012,2013,2014 2013 2012,2013,2014 2014 2012,2013,2014 2015 I wanted to create a dummy variable, which indicates whether the value in column B exists in column A. 1 indicates the existence, and 0 indicates non-existant. Such that, A B dummy 2012,2013,2014 2011 0 2012,2013,2014 2012 1 2012,2013,2014 2013 1 2012,2013,2014 2014 1 2012,2013,2014 2015 0 I have tried to use %in% to achieve this: df$dummy <- ifelse(df$B %in%

Test whether any input in a set of numbered input objects in R Shiny is empty

爱⌒轻易说出口 提交于 2021-02-08 02:09:27
问题 Let's say I have created 10 selectInput dropdowns for a multi plot export and these selectInputs are called "xaxis_1", "xaxis_2", ..... , "xaxis_10" for a single 1 I can write: if(!is.null(input$xaxis_1)) { .... do stuff } to stop it running export when the user hasn't entered any name, and presses submit, to avoid crashes. A bit more general you can check this: if(!is.null(input[[paste('xaxis', i, sep = '_')]])) { ...} how can you write it elegantly so that 1 line of code checks whether ANY

Test whether any input in a set of numbered input objects in R Shiny is empty

怎甘沉沦 提交于 2021-02-08 02:08:11
问题 Let's say I have created 10 selectInput dropdowns for a multi plot export and these selectInputs are called "xaxis_1", "xaxis_2", ..... , "xaxis_10" for a single 1 I can write: if(!is.null(input$xaxis_1)) { .... do stuff } to stop it running export when the user hasn't entered any name, and presses submit, to avoid crashes. A bit more general you can check this: if(!is.null(input[[paste('xaxis', i, sep = '_')]])) { ...} how can you write it elegantly so that 1 line of code checks whether ANY

How to get the mode of a column in pandas where there are few of the same mode values pandas

試著忘記壹切 提交于 2021-02-05 08:09:31
问题 I have a data frame and i'd like to get the mode of a specific column. i'm using: freq_mode = df.mode()['my_col'][0] However I get the error: ValueError: ('The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()', 'occurred at index my_col') I'm guessing it's because I have few mode that are the same. I need any of the mode, it doesn't matter. How can I use any() to get any of the mode existed? 回答1: For me your code working nice with sample data. If

using linq to find if a text field contains any string in a list

假装没事ソ 提交于 2021-01-29 07:40:04
问题 im running this in asp.net core v3.1 my question is similar to this question: How to use Linq to check if a list of strings contains any string in a list with the specific question relating to the first answer such that filterTags = ["abc", "cd", "efg"] var results = db.People .Where(p => filterTags.Any(tag => p.Tags.Contains(tag))); so basically saying give me results from the db of all People who's Tags field contains any of the filterTags where Tags = a big text field populated by a bunch

Filter rows which has at least one of particular values

时光总嘲笑我的痴心妄想 提交于 2021-01-27 16:41:37
问题 I have a data frame like this. df Tour Order Machine Company [1] A D D B [2] B B A G [3] A E B A [4] C B C B [5] A G G C I want to get the rows where the three columns Tour , Order Machine contains at least one D E or G . The result should be: Tour Order Machine Company [1] A D D B [3] A E B A [5] A G G C My attempt: df %>% filter(any(c(Tour, Order, Machine) %in% c('D', 'E', 'G'))) But it doesn't filter correctly(all the rows are returned). Could anybody please help me? 回答1: Another option:

EFCore 3.1 - Exists query via Any; Query cannot be translated

孤街醉人 提交于 2021-01-27 11:20:38
问题 We're using EFCore 3.1 and trying to build a query using Exists by means of .Any() which spans 2 properties. var selectionCriteria = someHugeList.Select(sh => new { sh.Id, sh.StatusCode }).ToList() var resultsQry = _myContext.SomeClass .Include(sc => sc.DetailRecords) .Where(sc => selectionCriteria.Any(crit => crit.Id == sc.Id && crit.StatusCode == sc.StatusCode)); var results = await resultsQry.ToListAsync() When running this query (even with a small amount (5 items) of selection criteria

EFCore 3.1 - Exists query via Any; Query cannot be translated

丶灬走出姿态 提交于 2021-01-27 11:20:07
问题 We're using EFCore 3.1 and trying to build a query using Exists by means of .Any() which spans 2 properties. var selectionCriteria = someHugeList.Select(sh => new { sh.Id, sh.StatusCode }).ToList() var resultsQry = _myContext.SomeClass .Include(sc => sc.DetailRecords) .Where(sc => selectionCriteria.Any(crit => crit.Id == sc.Id && crit.StatusCode == sc.StatusCode)); var results = await resultsQry.ToListAsync() When running this query (even with a small amount (5 items) of selection criteria