<jupyter_start><jupyter_text>Python for Psychologists - Session 3 from Session2: sets   later: handling data with dataframes & pandas  SetsSets are *unordered* and *unindexed* collections of things. Sets also differ from lists in that they cannot contain two identical elements. Sets can be created with the following syntax:```pythonmy_set = {"element1", element2, 4}```Create a set of three random inputs. Now try to create a set with a duplicate value. Take a look at the resulting set afterwards. Try to access the first element of your set. We can also convert lists to sets and vice versa:```pythonmy_list = [1,2,3,4]my_set = set(my_list)my_list = list(my_set)```Take the following list, convert it to a set and back to a list again.<jupyter_code>my_list = ["ich", "mag", "sets"]<jupyter_output><empty_output><jupyter_text>**Adding items to a set**We can add single items to a set using the following syntax:```pythonmy_set.add(new_item)```We can also add several items at once:```pythonmy_set.update({new_item1, new_item2})```Try to add some items to my_set. **Removing items from a set**Removing items from a set works similarly:```pythonmy_set.remove(item_to_be_removed)```Delete one of the items that you have just added.  handling data In the last two sessions you learned about the basic principles, data types, variables and how to handle them ... but **most** of the time we do not just work with single list, tuples or whatsoever, but with a bunch of data arranged in logfiles, tables, .csv files ..Today we learn about using **pandas** to ...  ![pandasUrl](https://media.giphy.com/media/fAaBpMgGuyf96/giphy.gif "pandas") ... well to actually handle our data. **Pandas** is your data's home and we can get familiar with our data by cleaning, transforming and analyzing it through pandas. For getting started, we need to `import pandas as pd ` to use all its provided features. We use ***pd*** as an abbreviation, since we are a bit lazy here :)<jupyter_code>import pandas as pd<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09099901088031652, 'fraction_numerical': 0.006429277942631058, 'mean_word_length': 5.1676829268292686, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '420845', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 594, 'n_tokens_neox': 564, 'n_words': 277, 'path': 'session3/Session3_sets_pandas_dataframes-empty.ipynb', 'repo_name': 'remayer/WS19_PsyMSc4_Python_for_Psychologists', 'size': '2022'}