About 164,000 results
Open links in new tab
  1. Use curly braces to initialize a Set in Python - Stack Overflow

    Curly braces or the set () function can be used to create sets. Note: to create an empty set you have to use set (), not {}; the latter creates an empty dictionary, a data structure that we …

  2. How can I create a Set of Sets in Python? - Stack Overflow

    I'm trying to make a set of sets in Python. I can't figure out how to do it. Starting with the empty set xx:

  3. How to create conda environment with specific python version?

    Jun 22, 2019 · Is it possible to access with the commands python and ipython both python version 3.3.0 in that specific environment, i.e. not by setting an alias in the .bashrc?

  4. How do I create a Python set with only one element?

    Aug 12, 2015 · The set() builtin expects an iterable type argument. In python, strings can be treated as iterable objects where each character is an element. Attempting to create a …

  5. How to create a venv with a different Python version

    Dec 20, 2021 · I had a similar case, and here is how I solved it with using pyenv to install different versions of the Python interpreter and venv to create a virtual environment.

  6. How to construct a set out of list items in python?

    Nov 27, 2016 · You can do my_set = set(my_list) or, in Python 3, my_set = {*my_list} to create a set from a list. Conversely, you can also do my_list = list(my_set) or, in Python 3, my_list = …

  7. python - Empty set literal? - Stack Overflow

    Apr 15, 2017 · By all means, please use set() to create an empty set. But, if you want to impress people, tell them that you can create an empty set using literals and * with Python >= 3.5 (see …

  8. python - Converting a list to a set changes element order - Stack …

    Mar 21, 2012 · The abstract concept of a set does not enforce order, so the implementation is not required to. When you create a set from a list, Python has the liberty to change the order of the …

  9. python - How do I create test and train samples from one …

    Jun 11, 2014 · I have a fairly large dataset in the form of a dataframe and I was wondering how I would be able to split the dataframe into two random samples (80% and 20%) for training and …

  10. python - Create a set from a series in pandas - Stack Overflow

    a=set(sf['Status']) print a According to this webpage, this should work. How to construct a set out of list items in python?