About 16,300,000 results
Open links in new tab
  1. How do I make a flat list out of a list of lists? - Stack Overflow

    Dec 3, 2016 · A list of lists named xss can be flattened using a nested list comprehension: flat_list = [ x for xs in xss for x in xs ] The above is equivalent to: flat_list = [] for xs in xss: for x in xs: …

  2. Best way to remove elements from a list - Stack Overflow

    Feb 2, 2014 · This makes indexing a list a[i] an operation whose cost is independent of the size of the list or the value of the index. When items are appended or inserted, the array of references …

  3. Get a list from Pandas DataFrame column headers

    Create a list of keys/columns - object method to_list() and the Pythonic way: my_dataframe.keys().to_list() list(my_dataframe.keys()) Basic iteration on a DataFrame …

  4. How to list all installed packages and their versions in Python?

    For Windows 10, I think this is what you are looking for a list of available installed Pythons. This is different from a list of packages as you can see below. Also, on Ubuntu 20.04, I think the …

  5. How do I concatenate two lists in Python? - Stack Overflow

    joined_list = [item for list_ in [list_one, list_two] for item in list_] It has all the advantages of the newest approach of using Additional Unpacking Generalizations - i.e. you can concatenate an …

  6. Array versus List<T>: When to use which? - Stack Overflow

    Jan 12, 2009 · Using e.g. List<Point> list, it would be necessary to instead say Point temp=list[3]; temp.x+=q; list[3]=temp;. It would be helpful if List<T> had a method Update<TP>(int index, …

  7. python - Find a value in a list - Stack Overflow

    Another alternative: you can check if an item is in a list with if item in list:, but this is order O(n). If you are dealing with big lists of items and all you need to know is whether something is a …

  8. Quick way to create a list of values in C#? - Stack Overflow

    How to initialize a list of strings (List<string>) with many string values (14 answers) Closed 8 months ago . I'm looking for a quick way to create a list of values in C#.

  9. How can I filter items from a list in Python? - Stack Overflow

    Aug 22, 2009 · my_list = ['foo','bar','baz','>=','5.2'] # With only_words = [token for token in my_list if token.isalpha()] # Without only_words = filter(str.isalpha, my_list) Personally I don't think you …

  10. Using List<T> in C# (Generics) - Stack Overflow

    Oct 2, 2013 · Basically, In C#, List < T > class represents a strongly typed list of objects that can be accessed by index. And it also supports storing values of a specific type without casting to …

Refresh