About 50 results
Open links in new tab
  1. python - Math operations from string - Stack Overflow

    Nov 13, 2016 · Let's say I have a standard Python string (such as one obtained from raw_input()), maybe "2 + 2" for simplicity's sake. I'd like to convert this string to standard math operations in …

  2. Using "and" and "or" operator with Python strings

    Also the type of the variable parameter is a string. In this context, as I can't imagine a case where usage of boolean operators on strings would make sense, I want to ask the question: Why would one want …

  3. Vectorize string operation in Python - Stack Overflow

    Feb 12, 2022 · a = ['red dwarf', 'smart cat'] b = ['red car', 'black hole', 'cat'] [[f(x,y) for x in a] for y in b] in a more efficient way. What options are actually available for a general (custom) Python function f pre …

  4. Time complexity of string concatenation in Python [duplicate]

    May 10, 2016 · Yes, in your case *1 string concatenation requires all characters to be copied, this is a O (N+M) operation (where N and M are the sizes of the input strings). M appends of the same word will …

  5. Python: apply math order of operations to reorder strings following ...

    May 11, 2021 · 1 How can be done with Python to reorder a string applying the math operations order with parenthesys? Let me use an example: "son(father(granpa)mother))" ===> "granpa father mother …

  6. python - Vectorized string operations in Numpy: why are they rather ...

    Mar 5, 2018 · Starting from numpy 1.4, if one needs arrays of strings, it is recommended to use arrays of dtype object_, string_ or unicode_, and use the free functions in the numpy.char module for fast …

  7. Is it possible to do bitwise operations on a string in Python?

    Aug 20, 2014 · I don't know about bitwise operations on strings but the struct worked great for me. Here's the use case. The SGF file format exists for recording certain games. In the case of Go, …

  8. python - Applying string operations to numpy arrays? - Stack Overflow

    Aug 1, 2013 · Python is already really good at handling string processing The other (and really, the main) reason numpy doesn't try to offer string operations is that python is already really good at it.

  9. python - How to turn strings into operations? - Stack Overflow

    Jul 21, 2022 · The point of eval() is to execute Python code that is stored as a string. If the user is inputting values to be used within an eval() statement, you should absolutely do some error-checking …

  10. python - How to do string operations when aggregating a pandas ...

    Mar 3, 2022 · I'm using pandas version 1.3.3. It seems I am only able to use builtin python functions, such as the max function, to aggregate columns that contain strings. Trying to do the same thing …