<jupyter_start><jupyter_text>Python integration (for use in Jupyter Notebooks) Please install the requirements using:    ```bashpip install pandas pydataset rpy2``` Load `rpy2` extension:<jupyter_code>%%capture
%load_ext rpy2.ipython<jupyter_output><empty_output><jupyter_text>Install the package (if not already installed):<jupyter_code>%%R
if (!require(devtools, quietly=T)) install.packages("devtools")
if (!require(ComplexUpset, quietly=T)) devtools::install_github("krassowski/complex-upset")<jupyter_output><empty_output><jupyter_text>Load ggplot2 and ComplexUpset<jupyter_code>%%R
library(ggplot2)
library(ComplexUpset)<jupyter_output><empty_output><jupyter_text>Prepare the datasets<jupyter_code>from pydataset import data as load_data
movies = load_data('movies').dropna()
movies.head(3).T
genres = list(movies.columns[-7:])
genres<jupyter_output><empty_output><jupyter_text>Convert the genre indicator columns to use boolean values:<jupyter_code>movies[genres] = movies[genres] == 1
movies[genres].head(3).T<jupyter_output><empty_output><jupyter_text>Quick notes on `rpy2` `%%R` magic usage - use `-i` switch to import data into R using rpy2 interface- `-w` and `-h` can be used to adjust the width and height of the plot- `-r` switch can be used to adjust DPI  Import the Python data frame to R<jupyter_code>%R -i movies -i genres<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11816192560175055, 'fraction_numerical': 0.008023340627279359, 'mean_word_length': 8.462068965517242, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '24203', 'license': 'MIT', 'n_tokens_mistral': 490, 'n_tokens_neox': 480, 'n_words': 116, 'path': 'vignettes/Prepare_Python.ipynb', 'repo_name': 'CyrilLagger/complex-upset', 'size': '1371'}