# Tag: boolean

## python – Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()

The Question : 461 people think this question is useful Having issue filtering my result dataframe with an or condition. I want my result df to extract all column var values that are above 0.25 and below -0.25. This logic below gives me an ambiguous truth value however it work when I split this filtering

## c++ – Strange definitions of TRUE and FALSE macros

The Question : 303 people think this question is useful I have seen the following macro definitions in a coding book. There was no explanation there. Please explain to me how these will work as TRUE and FALSE. The Question Comments : I think it’s just a funny way to define TRUE as 1 and

## gcc – Is bool a native C type?

The Question : 272 people think this question is useful I’ve noticed that the Linux kernel code uses bool, but I thought that bool was a C++ type. Is bool a standard C extension (e.g., ISO C90) or a GCC extension? The Question Comments : Section 9 of the comp.lang.c FAQ discusses this. Direct link:

## How to convert string to boolean php

The Question : 340 people think this question is useful How can I convert string to boolean? it returns, boolean true but it should be boolean false. The Question Comments : Why any answered about $bool=!!$string1 ? @zloctb because it doesn’t answer the question. !!\$string1 would return a boolean indicative of the string outlined in

## c++ – What is the printf format specifier for bool?

The Question : 508 people think this question is useful Since ANSI C99 there is _Bool or bool via stdbool.h. But is there also a printf format specifier for bool? I mean something like in that pseudo code: which would print: The Question Comments : You can read this for further information cplusplus.com/reference/cstdio/printf You can

## python – Parsing boolean values with argparse

The Question : 695 people think this question is useful I would like to use argparse to parse boolean command-line arguments written as “–foo True” or “–foo False”. For example: However, the following test code does not do what I would like: Sadly, parsed_args.my_bool evaluates to True. This is the case even when I change

## java – Check if at least two out of three booleans are true

The Question : 585 people think this question is useful An interviewer recently asked me this question: given three boolean variables, a, b, and c, return true if at least two out of the three are true. My solution follows: He said that this can be improved further, but how? The Question Comments : Inline

## Using boolean values in C

The Question : 736 people think this question is useful C doesn’t have any built-in boolean types. What’s the best way to use them in C? The Question Comments : C does have boolean type. At least there is one in the most recent standards. stackoverflow.com/questions/1608318/is-bool-a-native-c-type/… The Answer 1 1109 people think this answer is

## Converting from a string to boolean in Python?

The Question : 833 people think this question is useful Does anyone know how to do convert from a string to a boolean in Python? I found this link. But it doesn’t look like a proper way to do it. I.e. using built-in functionality, etc. The reason I’m asking this is because I learned about

## Which MySQL data type to use for storing boolean values

The Question : 1243 people think this question is useful Since MySQL doesn’t seem to have any ‘boolean’ data type, which data type do you ‘abuse’ for storing true/false information in MySQL? Especially in the context of writing and reading from/to a PHP script. Over time I have used and seen several approaches: tinyint, varchar