Questions tagged [multiple-conditions]

Examples include if, for, while and other loops.

while (a==1 && b==2)
{
   ...
}

The loop will continue as long as a is 1 and b is 2.

630 questions
3
votes
3 answers

How to categorize/classify numbers from different ranges using Excel?

I want to categorize numbers from [0:15] into 5 classes: A, B, C, D, E, F Rules: 0-1: Class A 2-4: Class B 5-7: Class C 8-10: Class D 11-13: Class E 14-15: Class F Explanation: if number is in range [0:1] then it will be classified as A; if a…
3
votes
2 answers

C# If not (this) Or (this) or (this) - Multiple condition IF/OR

I have a condition like: if (!(InRange1 || InRange2 || InRange3)) { //Do Something } Each of the InRange Variables are boolean. The desired behavior is if anyone of those values is False I want to do something, but it is not working that way. …
bairdmar
  • 113
  • 1
  • 2
  • 10
3
votes
3 answers

SQL query with multiple unrelated tables

In my mySQL database there are four tables: breakfast, dinner, supper, supper. Column names of these tables are the same. Everyone one of them has a column called 'accepted' which is equal to either 0 or 1. I want to make the SQL query that gives me…
CPG
  • 33
  • 7
3
votes
2 answers

Single regex - match only exactly defined names

There's a huge list of full names and I need to filter only those names where first name is longer than 3 alphabet characters and surname is longer than 7 alphabet characters. Full name should contain only 1 First name and 1 Surname separated by a…
ROR
  • 33
  • 3
3
votes
1 answer

How to avoid for-loops with multiple criteria in function which()

I have a 25 years data set that looks similar to the following: date name value tag 1 2014-12-01 f -0.338578654 12 2 2014-12-01 a 0.323379254 4 3 2014-12-01 f 0.004163806 9 4 2014-12-01 f 1.365219477 2 5…
Per
  • 577
  • 4
  • 7
3
votes
3 answers

LINQ to EF left join with multiple condition

I am trying to replicate the following SQL using LINQ to EF but with no luck. select * from Role left join QueueAccess on Role.RoleId = QueueAccess.RoleId and queueId = 361 Here's what I've tried. var myAccess = (from role in entity.Role.Include(p…
Joe
  • 31
  • 1
  • 2
3
votes
2 answers

How to simplify multiple conditions in Python

I wrote a script in python that parses some strings. The problem is that I need to check if the string contains some parts. The way I found is not smart enough. Here is my code: if ("CondA" not in message) or ("CondB" not in message) or ("CondC" not…
GiuseppeP
  • 81
  • 9
3
votes
6 answers

Haskell: Check if all conditions are true. If they are return true otherwise false

I was writing some Haskell this afternoon and I have a list of conditions that must be satisfied. If they are all true I want to return true, if one of them is false then return false. I have a method that is working but I was just wondering if…
visi0n
  • 35
  • 1
  • 4
2
votes
2 answers

Python: How to sort strings (filenames) by multiple conditions?

I have a problem with sorting my strings which are stored in a list. The string is actually a path/filename of a measurement and looks e.g. like this: 'Data\Test1\Test1__-10_step1.txt' -10 stands for the temperature…
Martin
  • 23
  • 3
2
votes
1 answer

Python Pandas Cumsum with reset everytime on multiple condition

I have a dataset like this : I want to make a two columns of cumulative sum of reference column. But I want to make it reset with two separate condition. For example, when I meet conditon 1, I want to reset just one column considering condition 1,…
stat_man
  • 91
  • 5
2
votes
1 answer

Multiple conditions using SumIFs

I am trying to automate sumIfs using multiple criteria for the below sample table. Column A to F is the data and the output table is displayed in column H through K. The output table sums the values in the data based on condition1 and condition2. I…
Sree
  • 21
  • 2
2
votes
2 answers

How to check multiple columns for matching regex rules to output in another column in PySpark

My dataframe: I have to check if the value in each column matches a certain rule. For example: If column 'a' has a number, column 'b' has xx or yy, column 'c' has 1 or 2, and column 'd' has 0 -> then the output should be 'output1' It is not…
2
votes
1 answer

passing conditions through dictionary lowercase not recognized

In this sample data: data = [{'source': ' Off-grid energy'}, {'source': 'off-grid generation'}, {'source': 'Off grid energy '}, {'source': 'OFFGRID energy'}, {'source': 'apple sauce'}, {'source': 'green energy'}, {'source': 'Green electricity…
SMJune
  • 407
  • 2
  • 12
2
votes
1 answer

How to avoid dummy clases during multiple inheritance with conditions

Is it possible to refactor multiinheritance without dummy classes? Maybe anybody have similar issue or have experienxe to tackle it, or at least tell me which way to look?? Code from __init__.py from configuration.global_vars import IS_JENKINS_JOB,…
2
votes
2 answers

calculate weights from a column in a dataframe with conditions R

I need to calculate weights from a column in a dataframe based on some conditions. I have Total Assets from several banks, with different countries, years and specializations. For each bank I want to calculate a weight (w) where w(i) = Tot_Asset…