About 47,400 results
Open links in new tab
  1. How to create tuple with a loop in python - Stack Overflow

    Feb 17, 2018 · How to create tuple with a loop in python [duplicate] Asked 7 years, 8 months ago Modified 2 years ago Viewed 76k times

  2. Create tuple of multiple items n Times in Python

    Nov 13, 2016 · Create tuple of multiple items n Times in Python Asked 8 years, 11 months ago Modified 2 years, 2 months ago Viewed 30k times

  3. python - How to merge lists into a list of tuples? - Stack Overflow

    What is the Pythonic approach to achieve the following? # Original lists: list_a = [1, 2, 3, 4] list_b = [5, 6, 7, 8] # List of tuples from 'list_a' and 'list_b ...

  4. python - How to create a "singleton" tuple with only one element ...

    How to create a "singleton" tuple with only one element Asked 13 years ago Modified 1 year, 3 months ago Viewed 122k times

  5. How to form tuple column from two columns in Pandas

    It's faster to create it, but any operations on that column will be faster in tuple form. For example, try calling .value_counts() on a column of lists vs a column of tuples.

  6. python - Use list comprehension to build a tuple - Stack Overflow

    Mar 14, 2013 · How can I use list comprehension to build a tuple of 2-tuple from a list. It would be equivalent to tup = () for element in alist: tup = tup + ((element.foo, element.bar),)

  7. python - Add another tuple to a tuple of tuples - Stack Overflow

    You can't---but you can redefine them, actually what you're doing is assigning a new tuple object to the existing variable foo (which happens to already hold another tuple object, but that's …

  8. python - Converting string to tuple without splitting characters ...

    To add some notes on the print statement. When you try to create a single-element tuple as part of a print statement in Python 2.7 (as in print (a,)) you need to use the parenthesized form, …

  9. python - create a tuple from columns in a pandas DataFrame

    I would like to automatically create a tuple (to be passed to a scipy.stats function) from columns in a pandas dataframe, so that each row of the tuple are the values from each column of the …

  10. python - How to get a tuple out of a generator? Best Practice

    Aug 25, 2015 · In Python, every comma separated list is a tuple, the parentheses are not necessary. So to make it clear, you can write the first function as def function_1(a,b): yield …